Welcome to WebmasterWorld Guest from 54.226.246.160

Forum Moderators: open

Message Too Old, No Replies

simple javascript question

make select change when image is clicked

     

shmekkyl

4:16 pm on Aug 14, 2003 (gmt 0)

10+ Year Member



I have a bunch of color options. When someone clicks on it, the image changes via javascript. I also want the select menu to change to reflect the color clicked. Also if someone changes the color in the select menu, I want the picture to change. This is what i'm using for the color change:


thumb =new Image();
thumb2=new Image();

thumb.src ="images/white2.jpg"
thumb2.src="images/black2.jpg"

function thumbtobig(thumbs)
{
if(thumbs==1){document.images['large'].src=thumb.src;}
if(thumbs==2){document.images['large'].src=thumb2.src;}
}

<a href="javascript:thumbtobig(1)"><img src="images/white.gif"></a>

<a href="javascript:thumbtobig(2)"><img src="images/black.gif"></a>

A point in the right direction would help me a lot. I dont work with JS that often so i'm a little rusty. Thanks.

jatar_k

6:09 pm on Aug 14, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



you could add an onChange event to the select box and maybe a parameter to your function to differentiate between a click and the select.

I haven't tried to auto switch the selectedIndex in a drop down but I would imagine it should work.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month