Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML, Dynamic Layers & Netscape

Status
Not open for further replies.

JTeagle

Programmer
May 30, 2000
49
0
0
GB
Does anyone know why the following HTML file causes Netscape Communicator 4.7x to screw up? It claims to be still reading the file but in fact it has got severely stuck - it needs manually killing with Task Manager.

I apologise for the length of code but this is the shortest snippet I can use to demonstrate the problem.

Code:
<html>

<head>
<title>Test Page</title>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

<script language=&quot;JavaScript1.2&quot;>

var WIDTH_LOGO = 288, HEIGHT_LOGO = 64 ;

function CreateLogoDiv()
{
	var	strSpeech = &quot;\&quot;&quot;;
	
   	document.write(&quot;<LAYER &quot;);
			
    document.writeln(&quot;ID=&quot; + strSpeech + &quot;divLogo&quot; + strSpeech); 
    document.writeln(&quot; STYLE=&quot; + strSpeech + &quot;position:absolute; width:&quot; + WIDTH_LOGO);
    document.writeln(&quot;; height:&quot; + HEIGHT_LOGO + &quot;; z-index:2;&quot; + strSpeech + &quot;>&quot;); 
    document.writeln(&quot;<IMG SRC=&quot; + strSpeech + &quot;some_image.gif&quot; + strSpeech + &quot;>&quot;);

   	document.writeln(&quot;</LAYER>&quot;);
}

</script>

Hello<BR>

<script language=&quot;JavaScript1.2&quot;>

// This call below should generate the following HTML, which of course is not 
// visible to the user:
//    <LAYER ID=&quot;divLogo&quot; STYLE=&quot;position:absolute; width:288; height:64; z-index:2;&quot;>
//        <IMG SRC=&quot;some_image.gif&quot;>
//    </LAYER>
CreateLogoDiv();

</script>

</body>

</html>
 
Boy Netscape is bad.

b[sup]2[/sup] - benbiddington@surf4nix.com
 
well there are many three ways that i can think of to fixthis problem. i work with all Netscape browsers and i have to degug the problems for the company.. so i understand what you are goingthru and yes indeed...nescape is bad.
1) change the postion: absolute to position: relative
this should allow you to move be more flexable with the layering.

2) from whati have researched, Netscape always has a hard time trying to distinguish the <layer> tag.the best way to go is to use the <DIV> tags. you cant go wrongthere. and the best thing about that is that all netscapes' understand the DIV tags

3) from what i could see. your best bet is to lower you z-index a little bit more.. try setting it to -50. play around with the numbering a little.

if all else fails, burn your computer and then throw it out you window then go to someone elses computer and try to hack netscape and end all the torment. lol

 
First, thanks for providing a useful response.

>2) from whati have researched, Netscape always has a hard
>time trying to distinguish the <layer> tag.the best way to
>go is to use the <DIV> tags. you cant go wrongthere. and
>the best thing about that is that all netscapes'
>understand the DIV tags

When I originally attempted to use a DIV, which would have allowed me to use the same code for IE and Netscape and I could have used a hard-coded layer within the HTML instead of using JavaScript to create it, I found that it (Netscape) did not allow me to change its position on the screen, which seemed daft. It DID allow me to move a LAYER though.

>3) from what i could see. your best bet is to lower you z-
>index a little bit more.. try setting it to -50. play
>around with the numbering a little.

I removed z-index to let it choose itself - made no difference. What I did find, though - by accident while trying this latest suggestion - is that if the image named is not found, it does not hang - only when the image is found. It is as if it can't load the image properly!! I tried a non-interlaced GIF and a JPG, and they both caused it to hang.

>if all else fails, burn your computer and then throw it
>out you window then go to someone elses computer and try
>to hack netscape and end all the torment. lol

Hmmm... I'll pass on that option. {:v)


Another interesting find: if you view the &quot;page source&quot; in Netscape generated by this HTML file, it shows:

Hello&lt;BR&gt;

&lt;LAYER ID=&quot;divLogo&quot;
STYLE=&quot;position:absolute; width:288
; height:64; &quot;&gt;
&lt;IMG SRC=&quot;xsome_image.gif&quot;&gt;
&lt;/LAYER&gt;
&lt;LAYER ID=&quot;divLogo&quot;
TTYLE=&quot;position:absolute; width:288
; height:64; &quot;&gt;

&lt;/BODY&gt;


In other words, it writes the layer correctly but then goes and rewrites the opening layer tag, INCORRECTLY - not only is there noo reason why it should do that, but it also MISSPELLS &quot;STYLE&quot; as &quot;TTYLE&quot; for some stupid reason...

Any ideas?
 
honestly about the part with the TTYLE, i have no idea, i will talk to the other programmers here and see if they have encountered such a problem and get back to you as soon as i could
 
What is the purpose of the &quot;strSpeech&quot; stuff in your code?

Changing the CreateLogoDiv() to something like this works for me, although the source code still shows the extra layer with style spelled wrong:
Code:
function CreateLogoDiv()
{
var ext = '<LAYER ID=&quot;divLogo&quot; STYLE=&quot;position:absolute; width:288; height:64; z-index:2&quot;>'
	+ '<IMG SRC=&quot;logo.gif&quot;>'
	+ '</LAYER>'
document.write(ext)
}
 
Unfortunately using ' instead of &quot; made no difference. I did not know you could use single quotes there, so I needed embedded double quotes - I separated them out to a variable in case I was getting out of sync when using them directly.

Thanks anyway, I at least have that useful suggestion for the future.
 
Unbelievable. You know what the answer is? Nutscrape doesn't like the layer string being split onto more than one line. If you use a giant variable as 'aperfectcircle' did above, or you use one giant document.writeln(), it works OK; even if you try to use several document.write()s and a final writeln(), it still goes wrong.

And I thought it was IE that was dodgy...

Thanks for the help folks, much appreciated.
 
what type of netscape are you using becasue i am able to get it to work on all netscapes EXCEPT NS6. that seems to be the only one that is giving the problem. i was reading up on netscape 6 and i found out that ns6 and ie6(soon to be released) doesnt support the LAYER tag anymore. so the only way around it would be to use the DIV tag. if there is anymoe info thati dont know about please let me know.. it would be greatly appreciated.

thanks
 
ok i dont undertand the significance of that. Communicator 4.76. please explain further.
 
I am using the package &quot;Netscape Communicator 4.76&quot; - that's it. I am not using the stand-alone &quot;Netscape Navigator 6&quot;, but the browser version that comes with the full package.
 
ohhhhhhhhhhhh ok nowi understand your point. i am as well but that doesnt seem to be the case. using layering will not work in most case if you are testing on ns6
 
I originally thought DIV would not allow you to move it in Netscape, but it seems it does - I must have been seeing one of the other 1.3 million bugs in Netscape and have been fooled...

Oh well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top