Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make live clock on website uisng Javascript?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 193
    Comment on it

    Hello readers if you want to show a live clock on your web page then you can use the javascript to make it.

    So lets start with html page. Create blank HTML page name is clock.html, And it's code will go like this:-

    <html>
    <head>
    <title>Javascript Digital Clock - An example of a Timer</title>
    </head>
    <body onload="start(document.LiveDate) ;">
    Clock will appear here
    <FORM name="LiveDate" action="post">
    <input type="text" name="date" size=30>
    </FORM>
    </body>
    </html>
    

    In this html you can see there is a text box name "date". Our Javascript function will show live clock in this text box.

    Now the Javascript code for this clock will go like this:-

    <script language="javascript" type="text/javascript">var LiveDate
    speed=1000
    ChangeInterveral=0;function LiveDateChanges()
    {f.date.value=new Date();ChangeInterveral=window.setTimeout("LiveDateChanges()",speed);}
    function start(x){f=x
    ChangeInterveral=window.setTimeout("LiveDateChanges()",speed);}
    function clearChangeInterveral(){window.clearTimeout(ChangeInterveral);}</script>
    

    Now paste this script at the bottom of clock.html page before body closing tag.
    When you load this page the live clock with date, time, month and day will show also it will show to current seconds changing.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: