title = document.title;
function showTime() {
d = new Date();
time = myfun(d.getHours()) + ":" + myfun(d.getMinutes()) + ":" + myfun(d.getSeconds());
//在标题栏中显示动态时间
document.title = title + " - " + time;
//在状态栏中显示动态时间
window.status = "状态栏中的时间为:" + time;
}
//这个方法是在个位数前加0
function myfun(op){
if(op<10){
op='0'+op;
}
return op;
}
setInterval("showTime()", 1000);