<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount(){
document.getElementById('txt').innerHTML=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}
function doTimer(){
if (!timer_is_on){
timer_is_on=1;
timedCount();
timedMsg();
}
}
function timedMsg()
{
var a=setTimeout("alert('5 seconds!')",5000);
}
</script>
</head>
<body onload="doTimer()">
<div id="txt"></div>
</body>