JavaScript for E-Commerce

Back | Contents | Next
Please note that this tutorial was first published in the year 2000, and is based on work conducted between 1997 and 2000. While we trust that it still constitutes useful tutorial material, it should not necessarily be construed as to impart best practice in the year 2017. For more details please see this blog post.

Framework

At this point we have enough information to build a navigable online shop, assuming that we have a list of CDs, records and tapes to sell.

The site will be built using frames, because we are going to use JavaScript to store a list of items the customer has ordered. If it was done with separate pages, you would lose this information every time the user navigated to a different page, unless cookies were used to store this data. The problem with doing this is that you end up with a lot of duplicated code in each page for loading and saving cookies.

The screen will be split into two distinct areas. The smaller area will allow the user to select product type and category, and to view a list of items. The larger area will be for display of the individual items themselves. More or less, it will look something like this:

[Product Type] [Item Name]  [Item Price]

[Item Picture]

[Item Description]
[Category]
- Item 1
- Item 2
- Item 3
- Item 4
- Item 5

Looking at this, we need several HTML documents:


Back | Contents | Next

This tutorial has been translated to Serbo-Croatian language by Jovana Milutinovich from Webhostinggeeks.com.

This tutorial has been translated to Slovak by Juraj Rehorovsky from Coupofy team.

If you find this tutorial useful and want to show your apprectiation, a small donation is most welcome, either in Bitcoins to 19QpWDmZPmTqawcr8VsXcbdc4Znq1ecrza, or via PayPal.