html
head
/head
body
div id=timeshow
/div
script type=text/javascript
var time=new Date();
time.setHours(1);
time.setMinutes(30);
time.setSeconds(0);
var timeout;
var timeshow=document.getElementById(timeshow);
function countdown(){
var hour=time.getHours();
var min=time.getMinutes();
var second=time.getSeconds();
if(hour==0&&min==0&&second==0){alert(Time Out!);clearInterval(timeout);}
time.setSeconds(second-1);
hour10?hour=0+hour:hour;
min10?min=0+min:min;
second10?second=0+second:second;
timeshow.innerHTML=hour+:+min+:+second;
}
timeout= setInterval(countdown,1000);
/script
/body
/html
初学菜鸟 编的不好请指教
取消
评论