PDA

View Full Version : Javascript help?


desigal
10-11-2007, 10:36 AM
Hi. I just started learning about Javascript, but I am having trouble on an assignment. Using HTML tags by making a table and heading, was easy, and then I had to put in a javascript code. I put a prompt box which asks the name of whoever's using it, and an alert box stating the person to look at the table with products being sold. I'm not sure how to do the next steps, which are to have two prompt boxes to take as input the name of the product the customer wants and the corresponding price from the table. (The user has to himself do a look up from the table and enter the name and corresponding price, the program doesn’t have to do this) Then, I have to take an input for the quantity of the product required, and then finally based on these inputs I have to calculate the cost of the purchase using the formula:

cost_of_order = price_of_product * quantity_required
Assuming that the shipping cost within the U.S. is $5. The final cost is calculated as cost_of_order + 5