Results 1 to 4 of 4

Thread: [DHTML] Basic Clock

  1. #1
    Join Date
    Mar 2008
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default [DHTML] Basic Clock

    1) CODE TITLE: Basic Clock

    2) AUTHOR NAME/NOTES:Windows Universe

    3) DESCRIPTION: This is a very small clock that shows your local time and it does not use AJAX or PHP to fetch the time.

    4) CODE:
    HTML Code:
    <script>
    
    var clockID = 0;
    
    function updateclock() {
       if(clockID) {
          clearTimeout(clockID);
          clockID  = 0;
       }
    
       var tDate = new Date();
    
       document.getElementById('TheTime').innerHTML = "" 
                                       + tDate.getHours() + ":" 
                                       + tDate.getMinutes() + ":" 
                                       + tDate.getSeconds();
       
       clockID = setTimeout("updateclock()", 1000);
    }
    function StartClock() {
       clockID = setTimeout("updateclock()", 500);
    }
    
    
    StartClock()</script>
    <h1 style="background-color: blue; color: white; width: 120px; height: 40px; font-family: arial;" id="TheTime"></h1>

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Its not a bad start. But maybe this should be a bit different. What if you tried making it in the form of a real clock? That'd be better.
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2008
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    This is a digital clock rendered by DHTML, not a regular clock.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Yea, well try to make that.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •