raman19
04-17-2008, 02:17 PM
Hi all,
i have a div that contains images. when one of these images is selected i want the background to change to show that it is selected or "on" . If there was another image that was previously on, i want it to be off by changing the background to the original color. This is similar to how a set of radio buttons works..
There will be one div which will be the container div. each image will have its own div with a unique ID. The number of images varies since they are loaded dynamically. It would look something like below. (This is obviously not complete)
<div class = "containerDiv" id="x" >
<div class="swatch" id="image1" />
<div class="swatch" id="image2" />
</div>
My thought was to have a javascript run where i pass it the image i want to appear on. and then it would cycle through the others and make sure that they appear off. so in psuedo code it would look like.
for each div in containerdiv
set background to off
i dont know the syntax for this.
Thanks in advance for any help. :)
i have a div that contains images. when one of these images is selected i want the background to change to show that it is selected or "on" . If there was another image that was previously on, i want it to be off by changing the background to the original color. This is similar to how a set of radio buttons works..
There will be one div which will be the container div. each image will have its own div with a unique ID. The number of images varies since they are loaded dynamically. It would look something like below. (This is obviously not complete)
<div class = "containerDiv" id="x" >
<div class="swatch" id="image1" />
<div class="swatch" id="image2" />
</div>
My thought was to have a javascript run where i pass it the image i want to appear on. and then it would cycle through the others and make sure that they appear off. so in psuedo code it would look like.
for each div in containerdiv
set background to off
i dont know the syntax for this.
Thanks in advance for any help. :)