Hello, I've been messing around with this code and can't get it to work right. I'm a newbie and don't know where the problem could be, maybe even a typo!
I butchered the code so many times but I'm out of ideas. At this point, I'm probably missing even more necessary parts to it.
Please note: the first code listed WORKS. The second code listed is the one I need help with!
I had this code working without an image map (so it would switch images when clicked anywhere on the image) but can't get the format to work with image map. Eventually I would also like to add a OnClick=(index++) once I get it to change at least on first click.
I butchered the code so many times but I'm out of ideas. At this point, I'm probably missing even more necessary parts to it.
Please note: the first code listed WORKS. The second code listed is the one I need help with!
Code:
<html> <body> <body bgcolor="white"> <!--<body background="C:\WINDOWS\Web\Wallpaper\20.jpg"> --> <script type="text/javascript"> <!-- var index = 2 changeIMG = new Array(); changeIMG[0] = new Image; changeIMG[0].src = "C:/WINDOWS/Web/Wallpaper/47.jpg"; changeIMG[1] = new Image; changeIMG[1].src = "C:/WINDOWS/Web/Wallpaper/48.jpg"; changeIMG[2] = new Image; changeIMG[2].src = "C:/WINDOWS/Web/Wallpaper/49.jpg"; changeIMG[3] = new Image; changeIMG[3].src = "C:/WINDOWS/Web/Wallpaper/50.jpg"; changeIMG[4] = new Image; changeIMG[4].src = "C:/WINDOWS/Web/Wallpaper/51.jpg"; changeIMG[5] = new Image; changeIMG[5].src = "C:/WINDOWS/Web/Wallpaper/52.jpg"; function doChangeMe(index) { document.myIMG.src=changeIMG[index].src; } </script> <img src="C:\WINDOWS\Web\Wallpaper\spacer.gif" BORDER=0 HEIGHT=500 WIDTH=300> <center> <a href="javascript:doChangeMe(index)"onClick="index++";><img src="C:/WINDOWS/Web/Wallpaper/47.jpg" name="myIMG" width="256" height="204" border=0></a> </center> </body> </html>
I had this code working without an image map (so it would switch images when clicked anywhere on the image) but can't get the format to work with image map. Eventually I would also like to add a OnClick=(index++) once I get it to change at least on first click.
Code:
<html> <body> <body bgcolor="white"> <script type="text/javascript"> <!-- var index = 2 changeIMG = new Array(); changeIMG[0] = new Image; changeIMG[0].src = "C:/WINDOWS/Web/Wallpaper/47.jpg"; changeIMG[1] = new Image; changeIMG[1].src = "C:/WINDOWS/Web/Wallpaper/48.jpg"; changeIMG[2] = new Image; changeIMG[2].src = "C:/WINDOWS/Web/Wallpaper/49.jpg"; changeIMG[3] = new Image; changeIMG[3].src = "C:/WINDOWS/Web/Wallpaper/50.jpg"; changeIMG[4] = new Image; changeIMG[4].src = "C:/WINDOWS/Web/Wallpaper/51.jpg"; changeIMG[5] = new Image; changeIMG[5].src = "C:/WINDOWS/Web/Wallpaper/47.jpg"; function doChangeMe(index) { document.myIMG.src=changeIMG[index].src; } </script> <img src="C:\WINDOWS\Web\Wallpaper\spacer.gif" BORDER=0 HEIGHT=500 WIDTH=300> <center> <map name="map"> <area href="javascript:doChangeMe(index)" shape="rect" coords="1,1,128,102"> </map> <img src="C:/WINDOWS/Web/Wallpaper/47.jpg" width=256 height=204 border=0 usemap="#map"> </center> </body> </html>
Comment