Here's a more complete example:
<script type="text/javascript">
//<![CDATA[
seconds = 180; // number of seconds to wait
id = 'submit';
onload = function() {
timestamp = new Date();
time = timestamp.getTime();
}
function countdown() {
c_timestamp = new Date();
c_time = c_timestamp.getTime();
if (Math.floor((c_time - time)/1000) == seconds) {
document.getElementById(id).disabled = true;
clearInterval(timer);
}
}
timer = setInterval("countdown()", 1000);
//]]>
</script>
</head>
<body>
<form action="">
<p><input type="submit" name="submit" id="submit" value="submit" /></p>
</form>
You won't see anything until the submit button disables itself after 3 minutes (180 seconds).