Web Analytics Made Easy -
StatCounter How do I swap an image on a page using multiple variables? - CodingForum

Announcement

Collapse
No announcement yet.

How do I swap an image on a page using multiple variables?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I swap an image on a page using multiple variables?

    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.

  • #2
    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.

    Comment

    Working...
    X