Код:
<body bgcolor="#FFFFFF" text="#000000" onload="start(document.forms[0])"
onunload="cleartids()">
<script language="JavaScript">
timestr = "00:00:00";
tid = 0;
pause = 0;
var to;
var bcount;
var tcount;
function writer(){
document.write("test"); 
}
function time(n) {
    tid=window.setTimeout("time(1)",to);
    today = new Date()
    if(today.getMinutes() < 10){ 
        pad = "0"}
    else  
    pad = "";
    if(today.getSeconds() < 10){ 
        pads = "0"}
    else  
    pads = "";
timestr=today.getHours()+":"+pad+today.getMinutes()+":"+pads+today.getSeconds();
                document.title = timestr;
    window.clearTimeout(tid);
    tid=window.setTimeout("time()",to);
}
function start(x) {
    f=x;
                to=60;
    time(x);
    }
function cleartids() {
	window.clearTimeout(tid);
}
</script>

Посмотреть как работает