+ Reply to Thread
Results 1 to 2 of 2

Thread: Timer

  1. #1


    I`d like to display a clock on my website so visitors can keep track of time while they are browsing website
    I`d like to do that without page being completly reloaded because i tried that and i couldn`t , a friend told me
    to use Jquery but i want this in JavaScript

  2. #2
    Junior Member
    Join Date
    Apr 2012
    It is so simple , you are going to use the local time of computer to be the clock
    and set interval to 1 sec and when it ticks it will update the time.
    <script type="text/javascript">
    function myFunction()
    function myTimer()
    var d=new Date();
    var t=d.toLocaleTimeString();
    document.getElementById("demo").innerHTML=t; // change demo to your tag ID
    And in HTML create a TAG with ID "demo"
    <p id="demo"></p>

+ Reply to Thread

Tags for this Thread


Posting Permissions

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