[Javascript] (no subject)

Larry Cotton laurence.cotton at ntlworld.com
Wed Dec 11 11:23:07 CST 2002


I'm attempting to update some information in a form using an external 
reference to a window opened using the open() method.

My test scripts look something like (deb_prn simply writes to a debug window) :

WinOpTst.htm - file containing the code to open the window
<script language="javascript" type="text/javascript"><!--
var popPgWin = window.open("popPgTst.htm", "PopPgTst");

deb_prn("popPgWin.document.forms.length = " + popPgWin.document.forms.length);
deb_prn("popPgWin.document.forms[0].name = " + 
deb_prn("popPgWin.document.forms.length = " + popPgWin.document.forms.length);
deb_prn("popPgWin.document.forms.TextBox1.value = " + 


<form name="form1">
<input type="text" name="TextBox1" value="Hello" size="20"></input>

When I open WinOpTst.htm in IE 5 the output I get is :
popPgWin.document.forms.length = 0
popPgWin.document.forms[0].name = form1
popPgWin.document.forms.length = 1
popPgWin.document.forms.TextBox1.value = Hello

    ... which is almost what I expect, except for some reason the length of 
forms[] returns 0 until the form itself has been accessed.

When I open it in Netscape 7.0 the output is :
popPgWin.document.forms.length = 0

and there is an error message saying ' popPgWin.document.forms[0] has no 

Does anyone know what is going on here and how I can access the form in 
Netscape ?


More information about the Javascript mailing list