layer [myLayer] with style attributes
[top,left,width,height,z-index,visibility,etc] and the layer contains a bit
of text "myText" (Note that the visibility attribute is set to hidden)
myText
In Netscape the address to the DIV layer "myLayer" is
document.myLayer
in Explorer it is
document.all.myLayer.style
The W3C way of identifying the address is
document.GetElementById(‘myLayer’).style
To access the properties such as visibility under "myLayer" you would use
these addresses.
Netscape
document.myLayer.visibility
Explorer
document.all.myLayer.style.visibility
W3C
document.getElementById(‘myLayer’).style.visibility
To change the visibility of this layer you would assign a value to your
JavaScript address.
Netscape
document.myLayer.visibility = "visible";
Explorer
document.all.myLayer.style.visibility = "visible";
W3C
document.getElementById(‘myLayer’).style.visibility=”visible”;
Now the previously hidden layer is now visible. This is essentially how
DHTML works, but understand there are hundreds and hundreds of attribute
properties for text, images, documents and windows. Not all these
properties are supported in both browser and sometime accessing a property
requires a few more hurdles, but if you stick to the common denominator
properties both browser use then life it a bit easier. I recommend the
excellent DHTML reference book Dynamic HTML - The Definitive Guide by Danny
Goodman (O'Riley Books) It lists all of the DHMTL properties and their
cross browser compatibilities.
About the Author
Eddie Traversa
DHTML Nirvana http://nirvana.media3.net/ is a site
dedicated to exploring the possibilites of DHTML. It hosts free graphics,
dhtml templates and tutorials. Some of the tutorials emphasis is on
Flash/DHTML integration.