home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1999 July / www_07_1999.iso / prez / amiga / KidHTML1_25.lha / KidHTML1.25 / Script / timebox.js < prev    next >
Text File  |  1998-08-25  |  1KB  |  65 lines

  1. <!-- TWO STEPS TO INSTALL TIME BOX:
  2.  
  3.    1.  Paste the coding into the HEAD of your HTML document
  4.    2.  Add the last code into the BODY of your HTML document  -->
  5.  
  6. <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
  7.  
  8. <HEAD>
  9.  
  10. <SCRIPT LANGUAGE="JavaScript">
  11. <!-- Original:  Chris Englmeier <machin@mindspring.com>
  12.  
  13. <!-- This script and many more are available online from -->
  14. <!-- The JavaScript Source!! http://javascriptsource.com -->
  15.  
  16. <!-- Begin
  17. var Temp;
  18. setClock();
  19. function setClock() {
  20. Temp = "";
  21. now = new Date();
  22. var CurHour = now.getHours();
  23. var CurMinute = now.getMinutes();
  24. now = null;
  25. if( CurHour > 12 ) {
  26. CurHour = CurHour - 12;
  27. ampm = 1;
  28. }
  29. else
  30. ampm = 0;
  31. if( CurHour == 0 )
  32. CurHour = 12;
  33. if( CurMinute < 10 )
  34. CurMinute = "0" + CurMinute;
  35. CurHour = "<FONT SIZE=2><B>" + CurHour + ":" + CurMinute + "</B>";
  36. if( ampm == 1 )
  37. CurHour = CurHour + " P.M.";
  38. else
  39. CurHour = CurHour + " A.M.";
  40. Temp = CurHour;
  41. }
  42. function pathOnly (InString)  {
  43. LastSlash=InString.lastIndexOf ('/', InString.length-1)
  44. OutString=InString.substring  (0, LastSlash+1)
  45. return (OutString);     
  46. }
  47. // End -->
  48. </SCRIPT>
  49.  
  50. <!-- STEP TWO: Put this code into the BODY of your HTML document  -->
  51.  
  52. <BODY>
  53.  
  54. <CENTER>
  55. <TABLE BGCOLOR="#ffe9bf" cellpadding=3 border=1>
  56. <TR><TD align=center>
  57. <SCRIPT>
  58. document.write( Temp );
  59. </SCRIPT>
  60. </TD></TR>
  61. </TABLE>
  62. </CENTER>
  63.  
  64. <!-- Script Size:  1.41 KB  -->
  65.