1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

JavaScript code for a clock?

Discussion in 'JavaScript' started by MizzGlass, Jul 17, 2006.

  1. #1
    can anyone help out with java source code for a simple analog and digital clock?
    like a simple clock with moving hrs,mins and secs arm, also a digital clock
     
    MizzGlass, Jul 17, 2006 IP
  2. Albert_chu

    Albert_chu Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do u mean the ones that follow your mouse?? or jsut one taht sits on your site..
     
    Albert_chu, Jul 17, 2006 IP
  3. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    NOTE: Below code is not tested.


    <script type="text/javascript">
    function showTime ()
    {
       var now = new Date();
       var timeString = now.getHours + ":" + now.getMinutes() + ":" + now.getSeconds;
       document.getElementById("clock").firstChild.data = timeString;
       setTimeout("showTime()", 1000);
    }
    window.onload = showTime;
    </script>
    
    <div id="clock">00:00:00</div>
    Code (markup):
     
    phper, Jul 18, 2006 IP