i’ve this simple piece of code that don’t work in Internet Explorer, but do work in Chrome, Firefox etc.
It is a simple button image ‘rollover’ .
<html>
<head>
</head>
<body>
<img src="p1.png" name="img1" onMouseOver="document.images[0].src='p2.png'" onMouseOut="document.images[0].src='p1.png'" ></a>
</body>
</html>
What’s wrong in IE 6,7,8 ?
Change your code to this:
Also, I if your HTML page contains more data the the HTML page you’ve showed in your question, I suggest you put this code in the beginning of the
<body>in order to preload the rollover image so there will be no delay when you want the rollover to work (otherwise, the rollover image will be downloaded to the user’s device only when he hovers the image, causing a slight delay to the rollover (depending on theonMouseOverimage size)):And add the CSS
hiddenPicclass code:.hiddenPic { display: none; }Other methods to preload the rollover image can be done using CSS or the JavaScript
onLoadevent handler.