View Full Version : Image Swapping

02-13-2007, 06:01 PM
I have the following code to swap an image when a thumbnail is clicked:

<img id="ctl00_main_content_dlImages_ctl02_imgPic" class="csspointer" onclick="var button1_up = new Image(); button1_up.src = 'datastore/images/lrge_37disabled.jpg';document.largeimage.src = button1_up.src;" src="datastore/images/thmb_37disabled.jpg" alt="disabled.jpg" style="border-width:0px;" />

Which swaps:

<img src="http://www.youcanpark.com/datastore/images/lrge_37IMG_1122.JPG " id="largeimage"/>

It works fine in Firefox, but IE and Opera will not swap the image. Does anyone have any suggestions as to how I might correct this?


02-13-2007, 07:16 PM
document.largeimage is not the advisable way to access the image especially when u have an id attached to it


but, if u don't care for such things adding a name attribute to the image will do the trick too

<img src="http://www.youcanpark.com/datastore/images/lrge_37IMG_1122.JPG " id="largeimage" name="largeimage"/>

02-13-2007, 08:35 PM
I actually came to the same conclusion shortly after posting, works a treat. Many thanks for the quick advice Shyam.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum