[Javascript] Enumerate through element in NS 6/7

Hassan Schroeder hassan at webtuitive.com
Mon Oct 21 12:38:36 CDT 2002


Reuben D. Budiardja wrote:

> In NS4, I can accessing layer element (eg <DIV>) using 
> document.layers[index]

> This works in Mozilla, NS 6/7, and IE > 5.5 I think. The former does not work 
> in Mozilla, NS 6/7. So how can I iterate through element using the similar 
> way with document.layers[index] for those newer browser?

You can build an equivalent array using something like

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

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                   ---                      ---
                   ---     dream.  code.    ---






More information about the Javascript mailing list