[WEB4LIB] Re: layers in Javascript with IE and Netscape

Thomas Dowling tdowling at ohiolink.edu
Wed May 9 16:27:41 EDT 2001


> My own JS skills are mostly monkey see-monkey do, but I'm curious if
> anyone can explain what layers means in the IE context.  I understand
the
> Netscape 4 proprietary LAYER element (long discouraged even by Netscape
> and justly gone from NS6).  Is the IE equivalent a matter of using DOM
> calls to change the z-index values of overlapping DIVs?
>

Thanks for the several clarifications and examples I received.  I have a
better sense of what "layers" means in this context.

It bears pointing out that this too universal snippet of code...

  if (document.all) { // IE
    //do IE stuff
  } else if (document.layers) { // Netscape
    //do NS4 stuff
  }

...works with neither Opera 5.11 nor Mozilla/NS6.  It leaves out the one
actual standard for doing this, the W3C Document Object Model, which I
learned to test for with:

  ...else if (document.getElementsByTagName("*")) { // W3C DOM-compliant
browser

Browser sniffing is quicksand for the unwary web author; DOM sniffing is
even trickier.  Please don't fall into the "Works With BOTH Browsers"
habit.


Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu



More information about the Web4lib mailing list