O'Reilly logo

JavaScript Application Cookbook by Jerry Bradenbaugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. The JavaScript Shopping Cart

Application FeaturesJavaScript Techniques
• Versatile Client-Side Shopping Cart• Managing Multiple Windows and Document Content
• User-Friendly Interface Makes Shopping Easy• Maintaining Client State with Objects
• No Server-Side Processing Required (Until Check-out)• Adding Object Properties
• Program Monitors All Selections and Keeps a Running Total• Reusing a JavaScript Database
• Database Enables Accurate Product Searching• Number Rounding and String Conversion

If there is a single-most diverse and robust JavaScript application in this book, it is the one described here. With Shopping Bag, you need only the graphics and product details to quickly and easily add an online shopping cart to your site. You don’t need to create extra files to display your products. Shopping Bag takes care of that on the fly. No need for a server to calculate tax and totals. Shopping Bag accurately computes them on the fly as well. Adding and removing products from a user’s shopping bag takes only a click or two. Unlike server-based shopping bags, there’s no waiting.

Shopping Bag Walk-Through

Something really easy and intuitive for the online consumer usually means some extra elbow grease for the programmer. Not to disappoint you, this is the case here. The fun and functionality you get in return, however, make the effort well worth it. The description of Shopping Bag’s functionality and code are based on the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required