Click to See Complete Forum and Search --> : netscape problem


DSilpa
12-26-2002, 08:59 AM
Can anyone tell me why the javascript I have on my page (to enlarge an image upon double clicking) will not work with Netscape? Is there a way to make this work on Netscape?

Also the text in the table on the right (specifically #2) is messed up in Netscape. Any ideas?

Thanks.

My site:
http://perso.wanadoo.fr/david.silpa/paris.htm

blufive
12-26-2002, 12:54 PM
Text Item 2 is different because it's enclosed in a <p> tag, when none of the others are.

I think the javascript is relying on Microsoft's document.all API, which only works in IE - no other browser will work.

Try this:<html><head><title>fun with images!</title><script type="text/javascript">
<!--
function resizeImage(img,newsize){img.height=newsize}
// -->
</script></head>
<body><table><tr><td>
<img src="1.jpg" height="64" onDblClick="resizeImage(this,500)" onClick="resizeImage(this,64)">
</td></tr></table>
</body></html>
(tested in IE6, Opera 7, and a recent Mozilla nightly) It also has the advantage of using one function for all images (you just amend the function call) so you don't have to add more functions for every image.

gil davis
12-27-2002, 08:02 AM
NS 4 does not have events inherently assigned to an image, and will not resize an image without reflowing something on the page. Also, onDblClick doesn't work the way you'd think. The onClick will interfere with it.

It works fine in NS 6.