计时器javascript实现代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<script language="javascript">
function Change(HourSurplus,MinuteSurplus,SecondSurplus)
{
 
 SecondSurplus = SecondSurplus - 1;
 if (SecondSurplus<0)  
 {  
 SecondSurplus=60+SecondSurplus;  
 MinuteSurplus=MinuteSurplus-1;  
 }  
 if (MinuteSurplus<0)  
 {   
 MinuteSurplus=60+MinuteSurplus;  
 HourSurplus=HourSurplus-1;  
 }
 document.getElementById("asd").innerHTML=""+ HourSurplus +":"+ MinuteSurplus +":"+ SecondSurplus +"";
 setTimeout(function() {
 Change(HourSurplus,MinuteSurplus,SecondSurplus);
 },1000);
}

</script>
<span id="asd">11111</span>
<script language="javascript">
Change(1,59,59);
</script>
</body>

</html>
posted @ 2012-05-22 14:50  蛊惑Into  阅读(1987)  评论(0编辑  收藏  举报