uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
JavaScript Input Example 4

Knowledge Base Lobby : uShop Support Conference : General Questions
Oct-21-17 12:38 AM EST
Original Message
JavaScript Input Example 4
Author Albert Touma on 11-10-2000 at 13:26 (EST)
Can anyone help or tell me what I am doing wrong. I am trying to add to JavaScript Input Example 4 an additional image which change per the selected option.

Thank you




uShop Online Shopping System
















image1 = new Image();
image1.src="../images/example_shirt_blue.gif";
image2 = new Image();
image2.src="../images/example_shirt_red.gif";
image3 = new Image();
image3.src="../images/example_shirt_green.gif";
image4 = new Image();
image4.src="../images/example_shirt_yellow.gif";
logo11 = new Image();
logo11.src="../images/shirt_blue.gif";
logo12 = new Image();
logo12.src="../images/shirt_red.gif";
logo13 = new Image();
logo13.src="../images/shirt_green.gif";
logo14 = new Image();
logo14.src="../images/shirt_yellow.gif";
function changeImage(ref,selectedColor)
{
if (selectedColor == "Blue")
{
document.images[ref].src = image1.src;
}
else if (selectedColor == "Red")
{
document.images[ref].src = image2.src;
}
else if (selectedColor == "Green")
{
document.images[ref].src = image3.src;
}
else
{
document.images[ref].src = image4.src;
}
}

function changeImage(ref,selectedLogo)
{
if (selectedLogo == "1Blue")
{
document.images[ref].src = logo11.src;
}
else if (selectedLogo == "1Red")
{
document.images[ref].src = logo12.src;
}
else if (selectedLogo == "1Green")
{
document.images[ref].src = logo13.src;
}
else
{
document.images[ref].src = logo14.src;
}
}








Color:

Blue
Red
Green
Yellow


Blue
Red
Green
Yellow




Size:

S
M
L
XL

Qty:

























E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  RE: JavaScript Input Example 4 Bill Weiner, 2000-11-13 09:02:56 (1)

Messages In This Discussion
         1. RE: JavaScript Input Example 4
        Author Bill Weiner on 11-13-2000 at 09:02 (EST)
I think some of your HTML didn't show up when you posted your question to this forum, but from looking at the JavaScript portion....I think I understand what you are trying to do. That is, it looks like you want to have two different options lists...both of which change different images based on the option selected? If so, then I think the problem may just be that you gave both of your JavaScript functions the exact same names:

function changeImage(ref,selectedColor)
function changeImage(ref,selectedLogo)

That is, even though the function parameters are different, you should have a different name for the functions such as:

function changeImage(ref,selectedColor)
function changeImage2(ref,selectedLogo)

.... And don't forget to make the appropriate function name change in your HTML for the second option list too....by specifying the correct function names for the "onChange" actions.
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.