level 1
Jackson丶丶丶
楼主

例如6小时48分2秒,求帮忙修改为06小时48分02秒 也就是双位数代码如下:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>倒计时,每天00:00分重新倒计时。每天重复</title>
<style type="text/css">
#time {
font-size: 24px;
}
</style>
</head>
<body>
<script language=JavaScript>
var now = new Date();//当前时间
var isjx=0;
function GetServerTime(){
var d= now.getYear()+"/"+now.getMonth()+"/"+now.getDate()+" 00:00:00";//设置每天的16:30 为节点
var urodz = new Date(d);
now.setTime(now.getTime()+250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if((hoursRound==0 && minutesRound==0 && secondsRound==0)){//都等于0 说明过了16:30
isjx=1;
}
//判断
if(isjx==0 && (parseFloat(now.toTimeString().substr(0,2)+ now.toTimeString().substr(3,3).substr(0,2)+now.toTimeString().substr(6,7) )<=162959)){
document.getElementById("time").innerHTML = "距离开始 还有"+hoursRound + "小时" + minutesRound + "分钟" + secondsRound +"秒" ;
}else {
document.getElementById("time").innerHTML = "距离结束 还有 "+hoursRound + "小时" + minutesRound + "分钟" + secondsRound +"秒";
}
}
setInterval("GetServerTime()",250);
</script>
<span id="time"></span>
</body>
</html>