homepage Welcome to WebmasterWorld Guest from 54.205.207.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
simple javascript question
make select change when image is clicked
shmekkyl

10+ Year Member



 
Msg#: 534 posted 4:16 pm on Aug 14, 2003 (gmt 0)

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

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



 
Msg#: 534 posted 6:09 pm on Aug 14, 2003 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved