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

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