Forum Moderators: open

Message Too Old, No Replies

Layers and Netscape 4.7

using document.write with crazy results

         

knighty

12:13 pm on May 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a page I'm doing which loads content depending on wether of not you are logged on.

Everything is in layers (no tables whatsoever) I can position the layers fine in all the browsers but as soon as I move them to an external JS file and put doc.write tags round them it all goes pear shaped!! Only in NN4.7 though.

Also if i move the place where the code is inserted they also screw up which is bizarre as all the layers are positioned absolutley.

Any ideas whats going on and how I can get around it?

PS using SSI or PHP is not an option.

tedster

12:26 pm on May 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is NN4.7 showing any errors in the javascript console? (type javascript: in the location bar and press Enter)

sparrow

12:34 pm on May 28, 2002 (gmt 0)

10+ Year Member



Are you using an external css file in conjunction with your external js file?

knighty

12:55 pm on May 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



some of the layers use classes set in the style sheet (internal) but others dont use the style sheet at all.

netscapes acting a bit buggy at the moment but console doesnt bring anything up.

knighty

9:41 am on May 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, Try the following in IE then NN4.7

<script language="JavaScript">
document.write("<div id='test' style='position:absolute; left:200px; top:20px; width:200px; height:30px; z-index:1'>")
document.write("<b>I LOVE NETSCAPE!</b>")
document.write("</div>")
</script>

tedster

12:23 pm on May 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're right - I see the same problem. Not a clue if there's a workaround. What a nasty bug!

knighty

12:46 pm on May 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Found a work around sort of...just means rethnking the structure of the page.

for the css...
#test { position: absolute; z-index: 1; height: 30px; width: 200px; left: 200px; top: 20px}

for the body...
<script language="JavaScript">
document.write("<div id='test'>")
document.write("<b>I LOVE NETSCAPE!</b>")
document.write("</div>")
</script>

tedster

1:01 pm on May 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Weird that NN4 won't let you write the style declarations inline, but at least it works from the head or called externally.

I almost never use inline declarations, but I file that one in my memory banks just in case.

knighty

1:59 pm on May 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yeah pretty wierd...

I have two homepage versions that would load depending if someone was logged on so I wanted to keept the same names for the layers.

Just named them all different and it works - just a bit more code and not as easy to update.