Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1524 Images in a layers disappears in Netscape Navigator on resize

irt.org | Knowledge Base | JavaScript | Bugs | Q1524 [ previous next ]

Q1524 Images in a layers disappears in Netscape Navigator on resize

Affects: Netscape Navigator 4.x 4.x

If you put this in a layer <IMG name=img1 border=0 src="test.gif"> using the onLoad event handler, the image will disappear when the browser is resized.

Uncomment the commented line and comment the next to see that Netscape will look for a wysiwyg:// image

Solution is to give the image an absolute path either hardcoded or using the trick I have included

<html> 
<script> 
ie = (document.all); 
ns = (document.layers);
h = location.href;(p=h.lastIndexOf("/")) > 0 ? homedir=h.substring(0,p+1) : homedir = "";
function load() { 
//   html = '<a href="javascript:;)"><IMG name=img1 border=0 src="test.gif" onError="alert(\'error:\'+this.src)" onLoad="alert(\'loaded:\'+this.src)">Please resize window.</a>'; 
   html = '<a href="javascript:;)"><IMG name=img1 border=0 src="'+homedir+'test.gif" onError="alert(\'error:\'+this.src)" onLoad="alert(\'loaded:\'+this.src)">Please resize window.</a>'; 
   if (ie) document.all['lyrMain'].innerHTML = html; 
   else if (ns) { 
      document.layers.lyrMain.document.write( html ); 
      document.layers.lyrMain.document.close(); 
   } 
} 
</script> 
<body onload="load()">
<div id="lyrMain" style="position:absolute; top:100; left:100; width:400; height:400; background-color: #ddeeff; z-index:0; visibility:visible;"> 
Some text 
</div>
</body>
</html>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.