Hi all,
Like many here, i am a novice. i have read alot and gone through tutorials and actually have a good grasp of how functions, arrays, DOM and so on work.
But i just can’t put all the elements i have learn’t together to create my shopping cart site.
I’ll give you an over view of what I have to do, then what’s trouble me:
• Display of a few toys on a single web page with their name, image and price and a drop down menu to allow the user to select a desired quantity of each toy.
• Add to Shopping Cart – A button (“Add to Cart”) should appear either next to each toy or one for the entire page so that when clicked the desired quantity of each toy can be added to the shopping cart, by executing the appropriate event handler method and invoking the Javascript function AddToCart().
• AddToCart() function should do the following: i) Store the name of each toy, quantity and sum (calculated by quantity*price) in three global arrays name[],quantity[] and sum[].
• A “view shopping cart” button should also appear on the page so that when clicked the appropriate event handler method is executed which will invoke the Javascript function ViewShoppingCart(). The ViewShoppingCart() function should display the the contents of the user’s shopping cart in the form of a dynamically generated table. Each row of the table should display the name of the toy, the quantity, the price and the sum (quantity*price) which is present in the shopping cart. Finally the total price of all toys in the shopping cart should be displayed at the end of the table.
• The ViewCart() function should do the following i) Iterate (loop) through the three arrays name[],price[] and sum[] and display the elements of the three arrays in the cells of a dynamically generated table. The total sum of the shopping cart should also be displayed somewhere at the end of the table.
I would really appriciate some pointers on how to tackle this problem.
_____________________________________________________________________