PDA

View Full Version : Displaying Layers within Layers


pthompson2002
09-19-2002, 11:02 AM
I want to use layers to float a message scroller, the message scroller, for NS4, is in an <ilayer><layer> and works fine. However, when I add the extra layer to make it float the content of the <ilayer><layer> won't display. Below is the code that I'm using to create the scroller.


//Displays the scroller header in NS4
if (document.layers) {
document.write(<LAYER NAME="floatlayer" LEFT="'+floatX+'" TOP="'+floatY+'">');//this layer is supposed to make it float, when commented out the scroller works fine
document.write('<table border=0><tr><td bgcolor=red><font size=2 color=white><b>BCMC Broadcast Message</b></td><tr><td bgcolor=#CFD9FF>');
}
</script>
<!--Shows the title in the scroller in NS4-->
<ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};><layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight};></layer></ilayer>

<script language="Javascript">
//Displays the "Message X of X" in NS4
if (document.layers) {
document.write('</td></tr><tr><td bgcolor=red><ilayer id="ns4MsgCount"><layer id="ns4Msg2Count" width=600></layer></layer></td></tr></table>');
document.write('</LAYER>');
}


I'm not sure if it is because their is no <Ilayer> for the float, I got the original code from:

http://www.echoecho.com/toolfloatinglayer.htm

if this is of any help

martin_narg
09-19-2002, 03:18 PM
it's to do with nested layers and how you reference them.

In IE and NS6 you can reference nested divs directly, but with netscape 4 you must do the full parent layer/child layer referencing.

Your referencing should be something like this:
to reference "fscrollerns"
document.layers["floatlayer"].document.layers["fscrollerns"]
to reference "fscrollerns_sub":
document.layers["floatlayer"].document.layers["fscrollerns"].document.layers["fscrollerns_sub"]

I could be slightly wrong in my referencing exact syntax, it's been a while since writing anything for netscape 4! However the theory says that the syntax is:
document.parentLayer.document.childLayer

hope this helps

m_n

pthompson2002
09-19-2002, 03:23 PM
cheers, I discovered the whole nested layers thing about half hour ago so I managed to fix it, thanks anyway