genghiscon.net
12-18-2002, 04:05 PM
I need an onMouseOver image flip function that does not require the anchor tag. Will anyone help?
|
Click to See Complete Forum and Search --> : onMouseOver without anchor genghiscon.net 12-18-2002, 04:05 PM I need an onMouseOver image flip function that does not require the anchor tag. Will anyone help? swon 12-18-2002, 04:40 PM It gives many different scripts, an easy script is the next, but it will not works in browser < 5 and I've not tried it in Opera: <html><head><title>Test</title> <script type="text/javascript"> <!-- function imageflip(nr) { obj = "flip"+nr; var newimg = new Array("test.jpg","nextnewimage.jpg"); var newalt = new Array("New Image0 Alt","New Image1 Alt"); elm = document.getElementById(obj).setAttribute("src",newimg[nr]); elm = document.getElementById(obj).setAttribute("alt",newalt[nr]); } function imageflipback(or) { obj = "flip"+or; var oldimg = new Array("yourimage.jpg","nextoldimage.jpg"); var oldalt = new Array("Old Image0 Alt","Old Image1 Alt"); elm = document.getElementById(obj).setAttribute("src",oldimg[or]); elm = document.getElementById(obj).setAttribute("alt",oldalt[or]); } //--> </script> </head><body> <img src="yourimage.jpg" id="flip0" width="100" height="50" border="0" alt="Old Image0 Alt" onMouseover="imageflip('0')" onMouseout="imageflipback('0')"> <img src="yourimage.jpg" id="flip1" width="100" height="50" border="0" alt="Old Image1 Alt" onMouseover="imageflip('1')" onMouseout="imageflipback('1')"> </body> </html> Beach Bum 12-18-2002, 04:48 PM a mouseover does not require an anchor in the first place. this works in both IE and NS. <img src="1.gif" onmouseover="document.header.src='2.gif'" onmouseout="document.header.src='1.gif'" width="65" height="65" name="header" alt=""> gil davis 12-18-2002, 06:26 PM this works in both IE and NS. You should provide specific version information. What you posted will not work in NS <= 4 or IE <= 3. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |