ShopIt V 6.0
SHOPIT TECHNICAL NOTES
1 WebService
ShopIt V 6.0 now uses a WebService to maintain the product stock instead of storing the data in a file. The WebService can be found in the ShopItWebService folder below the ShopIt root directory. The WebService is being used from the following two .asp files, basket.asp and product.asp.
2 Modifications

Every page now preloads the navigation arrow images     by JavaScript, e.g.:

<script>
   function preload() {
     if (!document.images) return;
     var ar = new Array();
     var myarguments = preload.arguments;
     for (var i = 0; i < myarguments.length; i++) {
       ar[i] = new Image();
       ar[i].src = myarguments[i];
     }
   }
</script>
<body onLoad="preload('./images/arrowRight.gif', './images/arrowRightBrown.gif')">

Every navigation link triggers the events onMouseover and onMouseout and loads the corresponding images, e.g.:

<img name="arrowimage" src="./images/arrowRight.gif" border=0>
<a href="main.asp?from=welcome"
  onMouseover="arrowimage.src='./images/arrowRightBrown.gif';"
  onMouseout="arrowimage.src='./images/arrowRight.gif';"
  class="linkShopIt">Join the experience!</a>

The products.asp document now uses JavaScript to prepare the product links.

<script>
   function ShowContent(url, category, name)
   {
     location.href = url + "?" + category + "=" + name;
   }
<script>

<p>
   <img name="image1" src="./images/arrowRight.gif">
   <a
     href="JavaScript:ShowContent('checkselection.asp', 'product', 'boots1')"
     onMouseover="image1.src='./images/arrowRightBrown.gif';"
     onMouseout="image1.src='./images/arrowRight.gif';">Boots1</a>
</p>

The checkout.asp document uses JavaScript together with ASP to prepare the Continue link, which features a session id, generated by ASP's Session object. The variable, which gets the session id is called "name" to get a more difficult sample for the parsing rules (it was called "sessionid" before).

<script LANGUAGE="JavaScript">
   function doProcess(mylink)
   {
     scheme="http://";
     server="<%=servername%>";
     serverport="<%=serverport%>";
     path="<%=newpath%>";
     file="kindofpayment.asp?";
     name="<%=session.sessionID%>";
     price="<%=totalprice%>";
     choice="CreditCard";
     mylink.href=scheme + server + serverport + path + file + "choice=" +
     choice + "&price=" + price + "&sid=" + name;
   }
</script>
<script>
  document.write("<a href='' onclick='javascript:doProcess(this)';
     onMouseover=arrowright.src='./images/arrowRightBrown.gif';
     onMouseout=arrowright.src='./images/arrowRight.gif';>Continue</a>");
</script>

The kindofpayment.asp document uses ASP together with JavaScript to perform a redirection to the next document.

<% theURL="http://"+servername+serverport+newpath+"card.asp?sid="+theSession %>
<script LANGUAGE="JavaScript">
   function doProcess()
   {
     document.location.href="<%=theURL%>";
   }
</script>
<body onLoad="doProcess();">
</body>

The card.asp document provides a FORM to be filled out by the user. This form is modified by the following ways:

The action URL is being modified:
<script>
   ...
   document.myForm.action = "acknowledge.asp";
   ...
</script>
<form name="myForm" action="nolink.asp" method="POST">
The input field zip is renamed into ZipCode:
<script>
   ...
   document.myForm.zip.name = "ZipCode";
   ...
</script>
...
<input type="text" size="20" name="zip" value="">
The credit card selection's value is being modified:
<script>
   ...
   if (document.myForm.cardtype.value == "AE")
   {
     document.myForm.cardtype.options[document.myForm.cardtype.selectedIndex].value =
     "American Express";
   }
   else if (document.myForm.cardtype.value == "MC")
   {
     document.myForm.cardtype.options[document.myForm.cardtype.selectedIndex].value =
     "Master Card";
   }
   else if (document.myForm.cardtype.value == "VC")
   {
     document.myForm.cardtype.options[document.myForm.cardtype.selectedIndex].value =
     "Visa";
   }
  ...
</script>
  ...
  <select class="selection" name="cardtype" size="1">
     <option name="nAE" value="AE">American Express</option>
     <option name="nMC" value="MC">MasterCard</option>
     <option name="nVC" value="VC">Visa</option>
  </select>

The acknowledge.asp document reuses the submitted data and displays some of the information provided by card.asp's form.


Back one step