home *** CD-ROM | disk | FTP | other *** search
/ PC User 2005 May / CD / PCU0505CD.iso / software / full / coffecup / files / html2005.exe / %MAINDIR% / Javascript / RandomAdSpace.xml < prev    next >
Encoding:
Text File  |  2005-02-16  |  1.8 KB  |  77 lines

  1. <ccResource>
  2.   <ccTitle>
  3. Random Ad Space
  4.   </ccTitle>
  5.   <ccCategory>
  6. Images
  7.   </ccCategory>
  8.   <ccDescription>
  9. Produces a randomly generated graphic to use as ad or cool effect.
  10.   </ccDescription>
  11.   <ccInstructions>
  12.  
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   
  16.   </ccHeadContent>
  17.   <ccBodyContent>
  18. <CENTER>
  19. <Script Language ="JavaScript">
  20. //Modified by Coffeecup Software
  21.  
  22. //produces a randomly generated graphic to use as ad or cool effect
  23.  
  24. function RandomNumber() 
  25. {
  26.   var today = new Date();
  27.   var num= Math.abs(Math.sin(today.getTime()/1000));
  28.   return num;
  29. }
  30.  
  31. function RandomGraphics() 
  32. {
  33.   var x = RandomNumber();
  34.  
  35.   if (x > .77) 
  36. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  37. }
  38.   if (x > .66) 
  39. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  40. }
  41.   if (x > .55) 
  42. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  43. }
  44.   if (x > .44) 
  45. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  46. }
  47.   if (x > .33) 
  48. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  49. }
  50.   if (x > .22) 
  51. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  52. }
  53.   if (x > .11) 
  54. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  55. }
  56.   if (x > 0)   
  57. {document.write("<A HREF='URL'><img src='image here' align=center hspace=10></a>"); return; 
  58. }
  59. }
  60.  
  61. RandomGraphics();
  62.  
  63. //End Script 
  64.  
  65. </SCRIPT>
  66. </CENTER>
  67.   </ccBodyContent>
  68.   <ccElementContent>
  69.   
  70.    <ccElementName></ccElementName>
  71.    <ccElementAction></ccElementAction>
  72.    
  73.   </ccElementContent>
  74.   <ccExtraData>
  75.  
  76.   </ccExtraData>
  77. </ccResource>