My intent is to have a default image in my web page replaced by "image1" when image1's thumbnail is clicked. I have the following in the <head> tag of my page: <script language="Javascript" type="text/javascript"> var im = new image(); im.src = 'image1.jpg'; </script> Code (markup): In the body of my page: onMouseDown="document.images.Pic.src=im.src" Code (markup): This code is in a <span> tag which spans the thumbnail to be clicked. (note : in the <img> tag of the picture to be replaced, I have name="Pic") For some reason, the picture doesn't load. Does anyone have any ideas? Thanks a lot
Try this: onMouseDown="document.getElementById('pic').src = im.src;" In your HTML code: <img id="pic" src="...." />