Forum Moderators: open

Message Too Old, No Replies

Referencing DIVs under Netscape's DOM

         

The_Jackass

8:40 pm on Jan 25, 2004 (gmt 0)



var isIE=document.all?true:false;
var layers = isIE?document.all.tags("DIV"):null;

I want to replace the "null" there with something that would get my script working under Netscape, but how do I reference ALL the DIV tags?

BlobFisk

1:27 pm on Jan 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, The_Jackass!

In old Netscape - that is, non DOM-1 compliant - the array was document.layers[].

HTH

garann

7:34 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



If you want to get all the DIVs in all modern browsers (including Netscape 6+, I believe), you can also use the getElementsByTagName function.

ex:

var layers = document.getElementsByTagName("div");

(No guarantees on the syntax, mind you..)