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

  1. <ccResource>
  2.   <ccTitle>
  3. Time
  4.   </ccTitle>
  5.   <ccCategory>
  6. Clocks
  7.   </ccCategory>
  8.   <ccDescription>
  9. This will place the current time in the Status Window of your browser.  
  10.   </ccDescription>
  11.   <ccInstructions>
  12. Place this script in between the HEAD tags of your webpage.  
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   <SCRIPT LANGUAGE="JavaScript">
  16. //Modified by CoffeeCup Software 
  17. //This code is Copyright (c) 1997 CoffeeCup Software 
  18. //all rights reserved. License is granted to a single user to 
  19. //reuse this code on a personal or business Web Site. 
  20.  
  21. var timerID = null;
  22. var timerRunning = false;
  23.  
  24. function stopclock (){
  25.         if(timerRunning)
  26.                 clearTimeout(timerID);
  27.         timerRunning = false;
  28. }
  29.  
  30. function showtime () {
  31.         var now = new Date();
  32.         var hours = now.getHours();
  33.         var minutes = now.getMinutes();
  34.         var seconds = now.getSeconds()
  35.         var timeValue = "" + ((hours >12) ? hours -12 :hours)
  36.         timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  37.         timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  38.         timeValue += (hours >= 12) ? " P.M." : " A.M."
  39.         window.status = timeValue;
  40.         timerID = setTimeout("showtime()",1000);
  41.         timerRunning = true;
  42. }
  43.  
  44. function startclock () {
  45.         stopclock();
  46.         showtime();
  47. }
  48.  
  49.  
  50. </SCRIPT>
  51.  
  52. <!--This is the end of the JavaScript Make sure this script is between the HEAD tags-->
  53.  
  54.  
  55.   </ccHeadContent>
  56.   <ccBodyContent>
  57.  
  58.   </ccBodyContent>
  59.   <ccElementContent>
  60.   
  61.    <ccElementName>onLoad</ccElementName>
  62.    <ccElementAction>showtime()</ccElementAction>
  63.    
  64.   </ccElementContent>
  65.   <ccExtraData>
  66.  
  67.   </ccExtraData>
  68. </ccResource>