A Cookie-Based Shopping Cart
You can build fairly complicated applications using cookies. This section discusses code that represents the start of a shopping cart script. You definitely do not want to use this code to run your own shopping cart—it's much too simplistic. For example, you can't remove an item from the basket once you've selected it.
However, this code should give you an idea of how to start building complex applications using cookies. Figure 12-10 shows you the code for a main page of a simple shopping cart (see Figure 12-11) with simple links to pages that contain items to buy.
Figure 12-10. The shopping cart main page
Figure 12-11. What ...
Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.