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

  1. <ccResource>
  2.   <ccTitle>
  3. Status Bar Clock
  4.   </ccTitle>
  5.   <ccCategory>
  6. Clocks
  7.   </ccCategory>
  8.   <ccDescription>
  9. This Script puts a digital clock in your status bar.
  10.   </ccDescription>
  11.   <ccInstructions>
  12.  
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   <script Language="JavaScript">
  16. var timerID = null;
  17. var timerRunning = false;
  18.  
  19. function stopclock (){
  20.         if(timerRunning)
  21.                 clearTimeout(timerID);
  22.         timerRunning = false;
  23. }
  24.  
  25.  
  26. function showtime () {
  27.         var now = new Date();
  28.         var hours = now.getHours();
  29.         var minutes = now.getMinutes();
  30.         var seconds = now.getSeconds()
  31.         var timeValue = "" + ((hours >12) ? hours -12 :hours)
  32.         timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  33.         timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  34.         timeValue += (hours >= 12) ? " P.M." : " A.M."
  35.         window.status = timeValue;
  36.         timerID = setTimeout("showtime()",1000);
  37.         timerRunning = true;
  38. }
  39. function coffeeclock () {
  40.         stopclock();
  41.         showtime();
  42. }
  43. </script>
  44.   </ccHeadContent>
  45.   <ccBodyContent>
  46.  
  47. <form name="clock" onSubmit="0">
  48.   </ccBodyContent>
  49.   <ccElementContent>
  50.   
  51.    <ccElementName>onLoad</ccElementName>
  52.    <ccElementAction>coffeeclock()</ccElementAction>
  53.    
  54.   </ccElementContent>
  55.   <ccExtraData>
  56.  
  57.   </ccExtraData>
  58. </ccResource>