JavaScript Input Example 2

The JavaScript on this page demonstrates how to utilize the "addProduct()" method to add an item to the shopping cart whenever an image is clicked. It also demonstrates how to use a form and a text box to allow the customer to enter the desired quantity.



<SCRIPT LANGUAGE="Javascript">
function addP00002()
"P00002",                        <!-- Product ID -->
"Firecrackers",                  <!-- Product Name -->
"Box of 500",                    <!-- Product Description -->
"0.5",                           <!-- Product Weight -->
document.P00002.quantity.value,  <!-- Product Quantity -->
"$4.95",                         <!-- Product Price (Each) -->
"$0.00",                         <!-- Extra Price Modifiers -->
"$0.00",                         <!-- Product Classification -->
"$0.00",                         <!-- Product Shipping Modifier -->
"YES");                          <!-- Taxable? -->

<FORM NAME="P00002">
<INPUT TYPE=text SIZE=4 NAME="quantity" VALUE="1">
<A HREF="" onClick="addP00002();return false;">
<IMG SRC="../images/example_add_button.gif" border=0 align=TOP></A>

Note: Don't forget to add the uShopJSI applet to your page too:
<APPLET CODE="uShopJSI.class" CODEBASE="../classes/" NAME="uShopJSI" WIDTH="2" HEIGHT="2">

More Information:

For more information about creating and using your own JavaScripts with uShop, see uShop and Java Scripts.