|
When the user clicks on a product, the showit sub modifies the contents of the topleft DIV block by displaying: (1) the image that was clicked; (2) the word "BUY"; (3) a textbox of size=2 named quantity that holds the quantity the user wishes to purchase; and (4) a hidden variable named product. This hidden variable is assigned the product number that was clicked (i.e., a 1,2,3,4,5 or 6). The result in the first column by clicking on the WATCH image is shown to the left. Note that the textbox named quantity and the hidden object named product are part of the first form named fred.
When the "Add to Order" button is clicked a VBscript sub named addit is called. This sub retreives the quantity and product values from fred and creates a three byte string. The first byte is the product (1 through 6) and the last two bytes are the quantity the user entered. If the quantity is only one digit, a zero is added to create a two byte value. The resulting 3 byte string is then appended (i.e., added to) the end of the ord string. The sub then: (1) replaces the contents of the first DIV block (id=topleft) with the "your0.gif" image and (2) calculates the a new total order amount. This order amount is found by using the ord string to get the product and quantity values for each item ordered. The six product prices are to be stored in a six element array named price. The total is found by summing the quantity * price value for each product ordered. The sub then replaces the contents of the second DIV block (id=orderamt) with: (1) the words "Total Order = $" and (2) the new total order amount.
Write the VBScript for showit and addit. Show NO HTML. Do NOT use on-the-fly creation (i.e., document.write)
|