Results 1 to 4 of 4

Thread: [DHTML] Scientific Millisecond Clock

  1. #1
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default [DHTML] Scientific Millisecond Clock

    1) CODE TITLE: Scientific Millisecond Clock

    2) AUTHOR NAME/NOTES: techno_race

    3) DESCRIPTION: A digital clock that measures down to the millisecond.

    4) Attached.
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Good Lord, you raped one of the easiest scripts to write:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Millisecond Clock</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    Number.prototype.pad = function(n) {
      for(var r = this.toString(); r.length < n; r = 0 + r);
      return r;
    };
    function updateClock() {
    	var now = new Date();
    	var milli = now.getMilliseconds(),
    	  sec = now.getSeconds(),
    	  min = now.getMinutes(),
    	  hou = now.getHours(),
    	  mo = now.getMonth(),
    	  dy = now.getDate(),
    	  yr = now.getFullYear();
        var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
        var tags = ["mon","d","y","h","m","s","mi"],
          corr = [months[mo],dy,yr,hou.pad(2),min.pad(2),sec.pad(2),milli];
        for (var i=0;i<tags.length;i++)
    	  document.getElementById(tags[i]).firstChild.nodeValue = corr[i];
    }
    
    function initClock() {
    	updateClock();
    	window.setInterval("updateClock()", 1);
    }
    </script>
    </head>
    <body onLoad="initClock()">
    <a id="mon">January</a>
    <a id="d">1</a>,
    <a id="y">0</a>
    <a id="h">12</a>
    :
    <a id="m">00</a>:
    <a id="s">00</a>:
    <a id="mi">000</a>
    </body>
    </html>
    - Mike

  3. #3
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default

    Yes, I made it the longest possible so it would look more complicated.
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Good job, 'ya done well.
    - Mike

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
  •