Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Location
    Norfolk, UK
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,071
    Thanks
    38
    Thanked 498 Times in 492 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •