on off




JavaScript Source Code 3000: Clocks: On/Off Clock





























On/Off Clock








This JavaScript example will display a JavaScript clock with an optional on/off switch.






var enabled = 0;
function TOfunc() {
TO = window.setTimeout( "TOfunc()", 1000 );
var today = new Date();
document.forms[0].elements[0].value = today.toString();
}



function Stopfunc() {
clearTimeout(TO);
var enabled = 0;
}




OFF
ON






JavaScript Source Code 3000: Clocks: On/Off Clock
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!




    





<!-- 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 -->











Wyszukiwarka

Podobne podstrony:
Zmiana dźwięku On Off
en om op on off 1408
starting off on the right foot dla szkoly podstawowej
VW EDC16 K LINE immo OFF ON (jednorazowy) pl
effect of varying doses of caffeine on life span D melanogaster
A Move On
making vise clamps on the milling machine
Ed Frawleys Philosophy on Dog Training
Dennett Facing Backwards on the Problem of Consciousness
Instructions on transfering
Destiny´s Child Get on the Bus
deRegnier Neurophysiologic evaluation on early cognitive development in high risk anfants and todd
Billy on WW3
Langtry Popper on Induction and Independence
Bee Gees Dreamin On

więcej podobnych podstron