Начало
Часы
Вкл\выкл Часы
Этот пример JavaScript покажет часы JavaScript с дополнительным, вкл\выкл
OFF
ON
JavaScript Clocks: Вкл\выкл Часы
<!-- TWO STEPS TO INSTALL ON/OFF CLOCK: 1. Add the onload event handler into the BODY tag of your page 2. Put the designated code into the BODY of your HTML document --> <!-- STEP ONE: Add the onload event handler into the BODY tag --> <BODY onload="TOfunc()"> <!-- STEP TWO: Put this code into the BODY of your HTML document --> <SCRIPT LANGUAGE="JavaScript"> <! > <! > var enabled = 0; function TOfunc() { TO = window.setTimeout( "TOfunc()", 1000 ); var today = new Date(); document.forms[0].elements[0].value = today.toString(); } </SCRIPT> <CENTER> <FORM> <CENTER> <input type="text" name="disp" value="" size=25 onFocus="this.blur()"><br> <input type="radio" name="rad" value="OFF" onClick="if( enabled ) { clearTimeout( TO ); enabled = 0; }"> OFF <input type="radio" name="rad" value="ON" checked onClick=" if( !enabled ) { TO = setTimeout( 'TOfunc()', 1000 ); enabled = 1; }" > ON<br> </CENTER> </FORM> <!-- Script Size: 1.00 KB -->