JavaScript Input Example 1

Description:
The very basic JavaScript on this page demonstrates how to utilize the "addProduct()" method to add an item to the shopping cart whenever an image is clicked.

Example:




Source:
<SCRIPT LANGUAGE="Javascript">
function addP00001()
{
document.uShopJSI.addProduct(
"P00001",     <!-- Product ID -->
"DVD",        <!-- Product Name -->
"Braveheart", <!-- Product Description -->
"0.5",        <!-- Product Weight -->
"1",          <!-- Product Quantity -->
"$34.95",     <!-- Product Price (Each) -->
"$0.00",      <!-- Extra Price Modifiers -->
"$0.00",      <!-- Product Classification -->
"$0.00",      <!-- Product Shipping Modifier -->
"YES");       <!-- Taxable? -->
}
</SCRIPT>

<A HREF="" onClick="addP00001();return false;">
<IMG SRC="../images/example_add_button.gif" border=0></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">
</APPLET>

More Information:

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