[thelist] DHTML Syntax Problem
Peter-Paul Koch
ppk at xs4all.nl
Sat, 04 Dec 1999 03:04:36
*** Original message ***
Does anyone know why when the following is executed in Netscape
Communicator 4.6
I get the error:
JavaScript Error:
file:/D|/Temp/test.htm, line 15:
document.layers[idMainMenu] has no properties.
Any help would be appreciated. I thought javascript access to DIV tags was
through the document.layers object (in Netscape).
***
Yes, in principle NN4 gives access to DIV's through document.layers.
However, the DIV must have a 'position' attribute in a style sheet. You can
either use 'position: absolute' or 'position: relative', but if neither of
them is defined Netscape doesn't see the DIV as a layer.
In addition I'd not recommend using DIV's intertwined with a table. Either
put the whole table in the DIV or only the content of one TD. The method
you use now can give problems (though I'm not sure of the details).
Further information about accessing DIV's for cross-browser DHTML purposes
can be found on my JavaScript Section at
http://www.xs4all.nl/~ppk/js
under 'Introduction to DHTML' and 'DOM'. Hope this helps,
ppk