View Full Version : How do I swap an image on a page using multiple variables?

08-22-2011, 04:21 PM
Hello all,

I am trying to make an image swap to another image, based on two variables.

i.e. Change an image of a “blue car with silver wheels” to a “red car with black wheels”.

The variables are the 1. colour of the car and 2. colour of the wheels. The visitor to the page will click on a coloured car icon to swap the image to the correct coloured car and then on a coloured wheel icon to change the wheel colour.

I have pre-prepared jpegs of all of the combinations of car/wheel colour.

Not sure at all about how to do this, or even if Javascript is the right way to go.

Struggling, so any suggestions gratefully accepted. Thanks.

08-22-2011, 06:11 PM
If you have only two variable, then name the images to the combinations available,
ie; blue_silver.jpg or red_black.jpg for the carColor_wheelColor.jpg designations.

Then depending upon the users choice, the correct image will be displayed.

Show some code and we can assist further.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum