
I tried ur code for multiple images but didnt get the right answer...i dont want the hardcodded code...a code which is flexible with multiple images
<html>
<script language="javascript" type="text/javascript">
if(document.images) {
arr = new Array();
arr[1] = new Image();
arr[1].src = "1.jpg";
arr[2] = new Image();
arr[2].src = "2.png";
}
function swapImages(imagename, pic) {
document.images[imagename].src = arr[pic].src;
}
</script>
<a onMouseOver="swapImages('img1',1)" onMouseOut="swapImages('img1',2)" href="javascript:void">
<img name="img1" src="1.jpg" width="250">
</a>
</script>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.