Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to change image on page from mulitple drop downs

Status
Not open for further replies.

M8KWR1

IS-IT--Management
Dec 8, 2008
20
0
0
GB
Is it possible to have on a form multiple drop downs, and then to get these to affect the image that is displayed on the webpage?

Example,

DD1 (Colour) - Red, Blue, white, black
DD2 (Front Logo) - Logo1, Logo2
DD3 (Front logo Colour) - Red, Blue, white, black
DD4 (back Logo) - Logo1, Logo2
DD5 (Back logo Colour) - Red, Blue, white, black

If so any help pointing me in the right direction would be great.

Many thanks in advance.
 
Yes - Investigate this the 'onchange' event of the SELECT object to have some code run when a user has changed the selection.

As for the images, you can set the 'src' attribute dynamically once you have a reference to the image object, e.g:

Code:
var myImg = document.getElementById('theImage');
myImg.src = '/images/whatever.jpg';

...

<img id="theImage" src="whatever.gif" />

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top