»
EnglishFrenchVietnamese

Print - Transform your form-buttons into realtime clocks - JavaScriptBank.com

Full version: jsB@nk » Form » Button » Transform your form-buttons into realtime clocks
URL: https://www.javascriptbank.com/transform-your-form-buttons-into-realtime-clocks.html

Transform your form-buttons into realtime clocks © JavaScriptBank.comDo you know the great dynamic capability of your form buttons? Soon you will! Test this JavaScript

Full version: jsB@nk » Form » Button » Transform your form-buttons into realtime clocks
URL: https://www.javascriptbank.com/transform-your-form-buttons-into-realtime-clocks.html



JavaScript
<SCRIPT language=javaScript><!-- Beginning of JavaScript -var showtime=truevar timervar i_sec=0function clockon() {    if (i_sec < 5) {    thistime= new Date()    var hours=thistime.getHours()    var minutes=thistime.getMinutes()    var seconds=thistime.getSeconds()    if (eval(hours) <10) {hours="0"+hours}    if (eval(minutes) < 10) {minutes="0"+minutes}    if (seconds < 10) {seconds="0"+seconds}    thistime = "----- "+hours+":"+minutes+":"+seconds+" -----"    document.forms[0].elements[0].value=thistime        i_sec++    timer=setTimeout("clockon()",1000)    }    else {        clearTimeout(timer)        i_sec=0        document.forms[0].elements[0].value="Tell me the time"    }}function clockoff() {clearTimeout(timer)    document.forms[0].elements[0].value="Tell me the time"}// - End of JavaScript - --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM><TABLE cellPadding=7 width=580>  <TBODY>  <TR>    <TD align=middle><BR><BR><INPUT onclick=clockon() onmouseout=clockoff() onmouseover=clockon() type=button value="Tell me the time">     </TD></TR>  <TR>    <TD align=middle></TD></TR></TBODY></TABLE></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->