• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. The JavaScript Shopping Cart > Step 3: Showing All the Categories

8.6. Step 3: Showing All the Categories

Choosing "Show All Categories" is another way to navigate through the products. Function showStore() is readily equipped to handle this task, as lines 33-47 show:

function showStore() {
  gimmeControl = false;
  var header = '<HTML><TITLE>Category</TITLE><BODY BGCOLOR=FFFFFF>';
  var intro = '<H2>Shopping Bag Product Categories</H2><B>';
  var footer = '</DL></BLOCKQUOTE></BODY></HTML>';
  var storeStr = '<BLOCKQUOTE><DL>';
  for (var i = 0; i < categorySet.length; i++) {
    storeStr += '<DT><A HREF="javascript: parent.frames[1].reCall(' + i +
       ', 0);">' + categorySet[i].name + '</A><DD>' +
       categorySet[i].description + '<BR><BR>';
    }
  infoStr = header + intro + storeStr + footer;
  parent.frames[0].location.replace('javascript:
     parent.frames[1].infoStr');
  }


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint