»
AnglaisFran�aisVietnamien

Imprimer - Ajouter Time script - JavaScriptBank.com

Version compl�te: jsB@nk » Heure » Horloge » Ajouter Time script
URL: https://www.javascriptbank.com/add-time-script.html

Ajouter Time script © JavaScriptBank.comUtilisez cette JavaScript à ajouter heure - Dans le forme des secondes, minutes ou heures - à l'heure actuelle.

Version compl�te: jsB@nk » Heure » Horloge » Ajouter Time script
URL: https://www.javascriptbank.com/add-time-script.html



JavaScript
<script type="text/javascript"><!--/*Created by: Sandeep Gangadharan :: http://www.sivamdesign.com/home/*/function sivamtime() {  now=new Date();  hour=now.getHours();  min=now.getMinutes();  sec=now.getSeconds();  if (min<=9) { min="0"+min; }  if (sec<=9) { sec="0"+sec; }  if (hour<10) { hour="0"+hour; }  document.hours.clock.value = hour;  document.minutes.clock.value = min;  document.seconds.clock.value = sec;  setTimeout("sivamtime()", 1000);}function sivamtime3() {  now5=new Date();    addH = document.addhours.addclock.value;  addM = document.addminutes.addclock.value;  addS = document.addseconds.addclock.value;  hour3 = parseInt(addH) + now5.getHours();  min3 = parseInt(addM) + now5.getMinutes();  sec3 = parseInt(addS) + now5.getSeconds();  if (sec3>=60) { sec3 = -(60 - sec3); min3 = parseInt(min3)+1; }  if (min3>=60) { min3 = -(60 - min3); hour3 = parseInt(hour3)+1; }  if (hour3>=24) { hour3 = -(24 - hour3); }  if (sec3<=9) { sec3="0"+sec3; }  if (min3<=9) { min3="0"+min3; }  if (hour3<=9) { hour3="0"+hour3; }  if ((addS>59) || (addM>59) || (addH>23)) { window.alert('Invalid Input!!'); return false; }  if ((addS.length > 2) || (addM.length > 2) || (addH.length > 2)) { window.alert('Invalid Input!!'); return false; }  if ((addS.indexOf('-') != -1) || (addM.indexOf('-') != -1) || (addH.indexOf('-') != -1)) { window.alert('Invalid Input!!'); return false; }  document.hours1.clock1.value = hour3;  document.minutes1.clock1.value = min3;  document.seconds1.clock1.value = sec3;  setTimeout("sivamtime3()", 1000);}--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="sivamtime()"><table border="5" align="center" cellpadding="0" cellspacing="0" width="160" bgcolor="#cccccc">   <tr>    <td>      <table border="0" align="center" cellpadding="0" cellspacing="0" width="80">        <tr>          <td align="center" colspan="3"><br />            <font face="verdana, arial, helvetica, sans-serif" size="1">              Current Time:            </font>          </td>        </tr>        <tr>          <td>            <form name="hours">              <p><input type="text" size="2" name="clock" /></p>            </form>          </td>          <td>            <form name="minutes">              <p><input type="text" size="2" name="clock" /></p>            </form>          </td>          <td>            <form name="seconds">              <p><input type="text" size="2" name="clock" /></p>            </form>          </td>        </tr>      </table><br />      <table border="0" align="center" cellpadding="0" cellspacing="0" width="150">        <tr>          <td align="center">            <font face="verdana, arial, helvetica, sans-serif" size="1">              Add Hours:            </font>          </td>          <td align="center">            <font face="verdana, arial, helvetica, sans-serif" size="1">              Add Minutes:            </font>          </td>          <td align="center">            <font face="verdana, arial, helvetica, sans-serif" size="1">              Add Seconds:            </font>          </td>        </tr>        <tr>          <td align="center">            <form name="addhours">              <input type="text" size="2" value="00" name="addclock" />            </form>          </td>          <td align="center">            <form name="addminutes">              <input type="text" size="2" value="00" name="addclock" />            </form>          </td>          <td align="center">            <form name="addseconds">              <input type="text" size="2" value="00" name="addclock" />            </form>          </td>        </tr>        <tr>          <td align="center" colspan="3">            <form>              <input type="button" value="Get Time"  onClick="sivamtime3()" style="font-size: 9pt" />            </form>          </td>        </tr>      </table>      <table border="0" align="center" cellpadding="0" cellspacing="0" width="80">        <tr>          <td align="center" colspan="3">            <font face="verdana, arial, helvetica, sans-serif" size="1">              Scheduled Time:            </font>          </td>        </tr>        <tr>          <td>            <form name="hours1">              <input type="text" size="2" name="clock1" />            </form>          </td>          <td>            <form name="minutes1">              <input type="text" size="2" name="clock1" />            </form>          </td>          <td>            <form name="seconds1">              <input type="text" size="2" name="clock1" />            </form>          </td>        </tr>      </table>    </td>  </tr></table></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->