[Javascript] (no subject)

charlie_chan charlie_chan at cox-internet.com
Wed Dec 11 12:07:29 CST 2002


I am confused about this code.  I do not see any thing that creates a form
on the Javascript created page.  It would look like:
popPgWin.document.write('<form>') & popPgWin.document.wrte('</form>') to
open and close a form created with JavaScript.

----- Original Message -----
From: "Larry Cotton" <laurence.cotton at ntlworld.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, December 11, 2002 11:23 AM
Subject: [Javascript] (no subject)


> 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
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list