Codice mini orologio ora minuti secondi

« Older   Newer »
 
  Share  
.
  1.     +1   -1
     
    .
    Avatar

    Advanced Member

    Group
    Super Amministratore
    Posts
    3,172
    Stima
    +66

    Status
    Offline
    CODICE
    <script type="text/javascript"><!--
    var timerID = null;
    var timerRunning = false;
    function StartClock (){

    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;
    showTime();
    }
    function showTime (){
    var adesso = new Date();
    var ore = adesso.getHours();
    var minuti = adesso.getMinutes();
    var secondi = adesso.getSeconds();
    var timeVal = "" + ore;
    timeVal += ((minuti < 10) ? ":0" : ":") + minuti;
    timeVal += ((secondi < 10) ? ":0" : ":") + secondi;
    document.orologio.tempo.value = timeVal;
    timerID = setTimeout("showTime()",1000);
    timerRunning = true;
    }
    //--></script>
    <body onload="StartClock()">
    <form name="orologio" onsubmit="0">Sono le ore <input type="text" name="tempo" size="8"></form>


    S' inserisce dove si vuole.
    Web
     
    Top
    .
0 replies since 25/1/2012, 17:02   30 views
  Share  
.