高分求高人,已经实现了秒递减,怎设置分钟递减?
两个button ,一个显示秒递减,一个显示分钟递减,下面的程序已经实现了秒的递减,怎么设置分钟也会递减啊,求高人指点啊!
<input type= "button " id= "agree " value= "等待时间为 " onclick= " ' ">
<input type= "button " id= "yes " value= "等待时间为 " onclick= " ' ">
</BODY>
</HTML>
<script type= "text/javascript ">
var settime=300;
var i;
var showthis;
document.all.agree.disabled=true;
for(i=1;i <=settime;i++) {
setTimeout( "update( "+i+ ") ",i*1000);
}
function update(num) {
if(num==settime) {
document.all.agree.value= "0 ";
document.all.agree.disabled=false;
}
else {
showthis=settime-num;
document.all.agree.value= "等待时间为 ( "+showthis+ ")秒 ";
}
}
</script>
------解决方案--------------------document.all.yes.value= "等待时间为 ( "+parseInt(showthis/60+1)+ ") 分 ";
------解决方案-------------------- <input type= "button " id= "agree " value= "等待时间为 " onclick= " ">
<input type= "button " id= "yes " value= "等待时间为 " onclick= " ">
</BODY>
</HTML>
<script type= "text/javascript ">
var settime=300;
var i;
var showthis;
document.all.agree.disabled=true;
for(i=1;i <=settime;i++) {
setTimeout( "update( "+i+ ") ",i*1000);
}
function update(num) {
if(num==settime) {
document.all.agree.value= "0 ";
document.all.agree.disabled=false;
}
else {
showthis=settime-num;
document.all.yes.value= "等待时间为 ( "+ Math.round(parseFloat(showthis/60)*100)/100+ ")分钟 ";
document.all.agree.value= "等待时间为 ( "+showthis+ ")秒 ";
}
}
</script>