Script Categories

Date & Time >>> On-Off.

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


Add the below code to the <body> section of your page:

<script language="JavaScript">
var enabled = 0;
function TOfunc() {
TO = window.setTimeout( "TOfunc()", 1000 );
var today = new Date();
document.OnOff.elements[0].value = today.toString();

function Stopfunc() {
var enabled = 0;
<FORM name="OnOff" id="OnOff">
type="text" name="disp" value="" size=35 onFocus="this.blur()"><br>
<input type="radio" name="rad" value="OFF" onClick="Stopfunc();"> OFF
<input type="radio" name="rad" value="ON" checked onClick="TOfunc();"> ON<br>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).