Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] (no subject)


  • From: javascript@xxxxxxxxxx (Larry Cotton)
  • Subject: [Javascript] (no subject)
  • Date: Wed, 11 Dec 2002 17:23:07 +0000

Hi

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 = " + 
popPgWin.document.forms[0].name);
deb_prn("popPgWin.document.forms.length = " + popPgWin.document.forms.length);
deb_prn("popPgWin.document.forms.TextBox1.value = " + 
popPgWin.document.forms.form1.TextBox1.value);

//--></script>

popPgTst.htm
----------------------
<body>
<form name="form1">
<input type="text" name="TextBox1" value="Hello" size="20"></input>
</form>
</body>

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 
properties'

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

Cheers
Larry