www.webdeveloper.com
Results 1 to 2 of 2

Thread: Is this doable without using Flash?

  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Exclamation Is this doable without using Flash?

    Hi There,

    I am hoping to find out if I can accomplish the following without using Flash:

    I have a client looking to be able to show a certain image based on 2 different selections. I need to be able to this this quite a few times. For instance, If I have 5 different options (Red, Blue, Yellow, Green, Orange, and Black) and another seperate option (1,2,3,4,5). And I would like someone to be able to select Red and 1 and show a specific picture, and a different picture for 2 and Blue etc.

    There would be only a maximum of 2 selections needed.

    Would this be a possibility using Javascript, I know it is for one selection, but I was not sure how to achieve this for two selections.

  2. #2
    Join Date
    Nov 2002
    Location
    Flint, Michigan, USA
    Posts
    586
    Create an array of pointers to the different images:
    Code:
    ImageSet=new Array(
    'image1.gif',
    'image2.gif',
    ...
    )
    Then a "value" for each color choice running 0 to 5:
    Code:
    <option value="0">Red</option>
    <option value="1">Blue</option>
    ...
    Finally, pick up both selection values, a bit of math, look up the image, and load it:
    Code:
    ArrayIndex=ColorValue*5+OtherValue-1;
    ImageSource=ImageSet[ArrayIndex];
    ...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles