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

  1. <ccResource>
  2.   <ccTitle>
  3. Fading Display
  4.   </ccTitle>
  5.   <ccCategory>
  6. Fun Stuff
  7.   </ccCategory>
  8.   <ccDescription>
  9. Just put this script on your webpage and the background color will change with a display of what the current hex code is.
  10.   </ccDescription>
  11.   <ccInstructions>
  12.  
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   
  16.   </ccHeadContent>
  17.   <ccBodyContent>
  18. <SCRIPT Language = "JavaScript">
  19.  
  20.     start = new Date();
  21.     minstart = start.getMinutes()
  22.     secstart = start.getSeconds()
  23.      
  24. function brighter(){
  25.  
  26.     var now = new Date();
  27.  
  28.     var seconds = now.getSeconds();
  29.  
  30.     var minutes = now.getMinutes();
  31.  
  32.     var base = "00";
  33.  
  34.     var color =  1000;
  35.  
  36.     var interval = 103;
  37.  
  38.     var sec= interval * (seconds - secstart);
  39.  
  40.     var min= 60 * interval * (minutes - minstart);
  41.  
  42.     var add= color + min + sec;           
  43.  
  44.     total= base + add;
  45.     if (add>=9999) {secstart = seconds; minstart = minutes}
  46.    
  47.     document.bgColor = total;
  48.     setTimeout("brighter()", 1000);
  49.         document.coffeeform.cc.value = total;
  50. }
  51. </script>
  52. </HEAD>
  53.  
  54. <form name="coffeeform">
  55. <P>This is the hex code of the current background color
  56. <input name = "cc" type="text" size="7">
  57. </form>
  58.   </ccBodyContent>
  59.   <ccElementContent>
  60.   
  61.    <ccElementName>onLoad</ccElementName>
  62.    <ccElementAction>brighter()</ccElementAction>
  63.    
  64.   </ccElementContent>
  65.   <ccExtraData>
  66.  
  67.   </ccExtraData>
  68. </ccResource>