on click link...can anyone help me to do this by hand code..its been ages since I've done it..no dreamweaver please...no swf..either thanks
If I understand it correctly, you need this: <html> <head> <title>Set Image Test </title> <script type="text/javascript"> window.onload=function(){ img1 = new Image (); img1.src = "Image1.jpg"; img2 = new Image (); img2.src = "Image2.gif"; img3 = new Image (); img3.src = "Image3.jpg"; } function setImage (obj1, obj2) { var image = document.getElementById ("myimg"); if(image.src == obj1.src){ image.src = obj2.src; }else{ image.src = obj1.src; } } </script> </head> <body> <a href="javascript:setImage (img1 , img2)"> <img id="myimg" alt="My Image" src="Image1.jpg" /></a> </body> </html> Code (markup):