Public feed #723850

Stuff

public javascript v1 · immutable
Raw Edit
·published 2007-10-03 02:28 UTC
rendered paste body
function mouseRollover(imageObject, imageName){  imageObject.src = "images/" + imageName;}//alert ("entering define variables");product01="DARE Tshirt";product01_desc="Help keep your kids off drugs with this D.A.R.E. T-shirt";product01_price=5;product01_image="<img class=imageborder src='dare.jpg'>";product02="Coach Tshirt";product02_desc="Something foryour favorite coach";product02_price=10;product02_image="<img class=imageborder src='images/coach.jpg'>";product03="Cat Tshirt";product03_desc="For the cat lover";product03_price=340;product03_image="<img class=imageborder src='images/cat.jpg'>";grandtotal=0;//alert ("exiting define variables");function getCurrentDate(){  alert("Entering getCurrentDate()");  today = new Date();  //alert("Load today = " + today);  monthnum = today.getMonth();  //alert("Load monthnum = " + monthnum);  datenum = today.getDate();  yearnum = today.getYear();  daynum = today.getDay();    daysoftheweek = new Array();  daysoftheweek[0] = "Sunday";  daysoftheweek[1] = "Monday";  daysoftheweek[2] = "Tuesday";  daysoftheweek[3] = "Wednesday";  daysoftheweek[4] = "Thursday";  daysoftheweek[5] = "Friday";  daysoftheweek[6] = "Saturday";  monthsoftheyear = new Array("January","February","March","April","May","June","July","August","September","October","November","December");  document.write(daysoftheweek[daynum] + ", " + monthsoftheyear[monthnum] + " " + datenum + ", " + yearnum);    //alert(monthnum);}function buildTable(){  //alert ("entering buildtable()");  document.write("<table id=shoppingcart>");  document.write("<tr><th>ITEM</th><th>QTY</th><th>UNIT PRICE</th><th>TOTAL PRICE</th></tr>");    //Read QueryString to Retrieve Arguments and Values  querystring = location.search.substring(1);  pairs = querystring.split("&");    for (i = 0; i < pairs.length; i++)  {    productname = "";    productprice = 0;		pos = pairs[i].indexOf('=');    argname = pairs[i].substring(0,pos);		switch (argname)	{	  case "QTY01":	    productname = product01;		productprice = product01_price;		break;	  case "QTY02":	    productname = product02;		productprice = product02_price;		break;	  case "QTY03":	    productname = product03;		productprice = product03_price;		break;	}		value = pairs[i].substring(pos+1);		if (value > 0)	{	  document.write("<tr><td>" + productname + "</td><td>" + value + "</td><td>" + productprice + "</td><td>" + (value * productprice) + "</td></tr>");	  grandtotal += (value * productprice);	}  }  document.write("<tr><td colspan=4><a href=checkout.htm><img border='0' src='images/btnCheckOut.jpg'></a>&nbsp;<a href=products.htm><img border='0' src='images/btnCancel.jpg'></a></td></tr>");  document.write("</table>");  setCookie('grandtotal',grandtotal,365);   //alert ("exiting buildtable()");}function rollover (image_object, image_name){  image_object.src = "images/" + image_name;}function getcurrentdate (){  //alert ("entering getcurrentdate()");  x = new Date();  monthnum = x.getMonth();  datenum = x.getDate();  daynum = x.getDay();    daysofweek = new Array();  daysofweek[0] = "Sunday";  daysofweek[1] = "Monday";  daysofweek[2] = "Tuesday";  daysofweek[3] = "Wednesday";  daysofweek[4] = "Thursday";  daysofweek[5] = "Friday";  daysofweek[6] = "Saturday";  monthsofyear = new Array("January","February","March","April","May","June","July","August","September","October","November","December");    document.write(daysofweek[daynum] + ", " + monthsofyear[monthnum] + " " + datenum + ", " + x.getYear() + "&nbsp;");      //alert ("exiting getcurrentdate()");}function getCookie(c_name){  if (document.cookie.length>0)  {     c_start=document.cookie.indexOf(c_name + "=")    if (c_start!=-1)    {       c_start=c_start + c_name.length+1       c_end=document.cookie.indexOf(";",c_start)      if (c_end==-1) c_end=document.cookie.length        return unescape(document.cookie.substring(c_start,c_end))     }    }   return ""}function setCookie(c_name,value,expiredays){  var exdate=new Date()  exdate.setDate(exdate.getDate()+expiredays)  document.cookie=c_name+ "=" +escape(value)+  ((expiredays==null) ? "" : "; expires="+exdate.toGMTString())}function loadTotalAmount(){  //document.frmCheckOut.grandtotalamount.value = getCookie('grandtotal');  document.write(getCookie('grandtotal'));}function buildOptions(inputMin, inputMax){	for (i = inputMin; i <= inputMax; i++)	{ 	  document.write("<option value=" + i + ">" + i "</option>);	}}function validateRequired(field){	with (field)	{		if (value == null || value == " ")		{			alert (field.name + " is requiered.");			return false;		}	}}