Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Change Image with Select box

Posted 25 Jun 2004 17:39:50
1
has voted
25 Jun 2004 17:39:50 Greg LeBreck posted:
In ASP with A MySQL database.

I have a clothing site, when you are lokking at a product like a shirt there a several colors. I have a select box that pulls the color options from the database. Each color has a picture that goes along with it that is referenced in the database. What I want to happen is when the user changes the the selectbox for the color it changes the picture also. And if there is a way to do this is there a way to do it with out refreshing the page also?
Thanks Guys.

Replies

Replied 25 Jun 2004 20:37:36
25 Jun 2004 20:37:36 Matt Millican replied:
You can dump the different colors and images into a javascript array, and then on the SELECT use an onChange event handler. To change the image without reloading the whole page this is an example of what your JS line would look like:
document.images["imgName"].src = array[1]

Hope this helps. Let me know if you need anything else.

Matt Millican
InternetMill.com
www.internetmill.com
(Win XP Pro / DWMX / Access XP / ASP / VBscript)

Reply to this topic