[Javascript] Netscape object model : forms in div/layer

Chris Basken chriz at basken.com
Thu Apr 19 09:28:15 CDT 2001


the problem is: NS4.x sees a layer as its own document, so try...

	document.layers['LayoutLYR'].document.forms.length

this will, of course, crash IE.  thank you, have a nice flight.

my final solution was to write a function that cycled through the layers (if
any) and searched for forms in them.  if it found one, it would assign it to
an element in an array.  i would also do this for IE, but simply replicate
document.forms into my array.  once that was done, i could reference any
form on the page by using my array, and it would work for NS and IE.


>
> A client using one of my form processing scripts starts his document
> body with
>
>     <div ID="LayoutLYR"><layer ID="LayoutLYR" ...>
>
>
> In consequence, in Netscape, this test
> - intended to ensure that the <FORM> </FORM> tags
>   were not forgotten when building the page - fails:
>
> function isForm(){
> // Any form on this page?
> if(window.document.forms.length==0)
> 	{
> 	alert('Whoops! : NO FORM! : CHECK PAGE for <form>..</form> tags');
> 	}
> }
>
> The good news is that the main part of the scripts operated OK since
> they pass their objects to my functions.
>
> I am not surprised, but I am frustrated that I cannot yet find the
> information on how Netscape wants the forms addressed in its object
> model.
>
> Can anyone point me at a good reference for this?
>
> TIA
>
>
> Rodney
>
>
> --
> Shop at ssistant Add-ons and Developer Workshops
> http://www.aflyingstart.net/addons/
> STILL PLACES OPEN on Fri 27 April workshop
>
> Courses in April
> Mon 23  : Making a Start in E-Commerce with Shop at ssistant
> Tue 24  : Meeting Business Needs with the Shop at ssistant Classic system
> Wed 25 : Building Better Shopping Pages with Shop at ssistant Classic
>
>
> Booking for these Shop at ssistant Classic courses at
> http://www.shopassistant.net/training/
> Or call 01256 880770
>
> Rodney Myers
> Based in Oxford, England
> Technical Director, Shop at ssistant eCommerce Solutions
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list