Start a counter that counts down from ten to zero at one-second intervals in the window status bar when you click the button.
The JavaScript:
var intervalTimer;
var counter = 10;
function startCounting( )
{
intervalTimer = window.setInterval( "countDown()", 1000 );
window.status = counter; // show the initial value
}
function countDown( )
{
counter = counter - 1;
window.status = counter;
if (counter == 0)
{
window.clearInterval( intervalTimer );
intervalTimer = null;
}
}
<form name="myForm" action="#">
<input type="button" value="Start counting"
onclick="startCounting( )" />
</form>