home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 January / chipcd20010102.iso / code / banners.js < prev    next >
Encoding:
Text File  |  2000-12-15  |  1.4 KB  |  29 lines

  1. function displayRandom468x60Banner()
  2. {
  3.     var imageIndex = 0;
  4.     imageList = new Array();
  5.  
  6.     imageList[imageIndex++] = new String("chip|orderform.htm|Your Navigator through Digital Technology");
  7.     imageList[imageIndex++] = new String("system_tools_cd|orderform_plus.htm|CHIP Plus System Tools - Order today!");
  8.     imageList[imageIndex++] = new String("freewarecd|orderform_plus.htm|CHIP Plus Freeware Collection - Order today!");
  9.     imageList[imageIndex++] = new String("kidsware|orderform_plus.htm|CHIP Plus Kidsware - Order today!");
  10.     imageList[imageIndex++] = new String("ffwd|http://www.chip-india.com/fastforward|Zip ahead with Fast Forward - Order Today!");
  11.     imageList[imageIndex++] = new String("cgw|orderform_cgw.htm|100% Gaming Masti .. Guaranteed!");
  12.     imageList[imageIndex++] = new String("cas|orderform_cas.htm|Computer Arts Special: The Digital Design Bible");
  13.     
  14.     var r = getRandomNum(0,imageList.length);
  15.  
  16.     var imgsrc = imageList[r].slice(0,imageList[r].indexOf("|"));
  17.     var ahref = imageList[r].slice(imageList[r].indexOf("|")+1,imageList[r].lastIndexOf("|"));
  18.     var alttext = imageList[r].slice(imageList[r].lastIndexOf("|")+1);
  19.  
  20.     document.write("<A HREF='orderform/" + ahref + "' target='_blank'>");
  21.     document.write("<IMG SRC='images/banner_" + imgsrc + ".gif' height=60 border=0 width=468 ALT='" + alttext + "'>");
  22.     document.write("</A>");
  23. }
  24.  
  25. function getRandomNum(lbound, ubound)
  26. {
  27.     return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
  28. }
  29.