Some problem about HTML frameset
<p>Today i was trying to study about frameset by creating a few pages , this is how the site works , the frameset-defining page is divided into two separate child frame , and inside the two pages contain a <b>textarea</b> and a <b>button</b> that will print out the pages that are visited to the <b>textarea</b> when user click the <b>button</b>,the page is as follow:</p>

<b>The frameset-defining page</b>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;title&gt;Example&lt;/title&gt;

&lt;head&gt;

&lt;script type="text/javascript"&gt;

var siteList = new Array();

function returnPageVisited_onclick()
{
 var returnValue = "The pages you've visited : " + "\n"

 for(var i = 0 ; i &lt; siteList.length ; i++)
 {
  returnValue += siteList[i] + "\n";
 }
 window.document.myForm.pageVisited.value = returnValue;
}

function printSiteLs_onload(fileNameStart)
{
 var pageName = fileNameStart.lastIndexOf("/") + 1;

 siteList[siteList.length] = fileNameStart.substr(pageName);
}

&lt;/script&gt;


&lt;/head&gt;



&lt;frameset cols="50% , *"&gt;

 &lt;frame src="pageA.html" name="fraLeft" /&gt;
 &lt;frame src="pageB.html" name="fraRight" /&gt;

&lt;/frameset&gt;


&lt;/html&gt;
</code></pre>

the frame page

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;title&gt;Example&lt;/title&gt;

&lt;head&gt;
&lt;/head&gt;

&lt;body onload="window.parent.printSiteLs_onload(window.location.href);"&gt;

&lt;h2&gt; This is Page A &lt;/h2&gt;

&lt;p&gt;

&lt;a href="pageA.html"&gt;Page A&lt;/a&gt;
&lt;a href="pageB.html"&gt;Page B&lt;/a&gt;
&lt;a href="pageC.html"&gt;Page C&lt;/a&gt;
&lt;a href="pageD.html"&gt;Page D&lt;/a&gt;

&lt;/p&gt;

&lt;form name="myForm"&gt;

&lt;textarea name="pageVisited" rows="10" cols="35"&gt;
&lt;/textarea&gt;

&lt;input type="button" name="myBtn" value="Click To Check"    onclick="window.parent.returnPageVisited_onclick()"/&gt;

&lt;br /&gt;

&lt;/form&gt;

&lt;/body&gt;

&lt;/head&gt;

&lt;/html&gt;
</code></pre>

<p>There are another 3 pages which are coded the same as the frame page above,just the line <code>&lt;p&gt; This is page A&lt;/p&gt;</code> is different , my problem is the line of code in the frameset-defining page ,that is <code>window.document.myForm.pageVisited.value = returnValue;</code> for the first function , firebug gave me an error <i>"window.document.myForm is undefined"</i>,here is how I think,I'm using the frameset to create a module to store generic function so that other pages could access the function in it,but I wonder why I'm getting this error since the function is not called in the mainpage but is called in the frame pages where myForm is defined,so why am I still getting this kind of error,much appreciated if someone could correct my statement if I'm wrong thank you</p>
