//个位秒加 function time4jia() { //分钟60为上限 所有加停止 if (sz(a('time1').innerHTML) == 6) { return; } var m4 = sz(a('time4').innerHTML);//取个位秒 if (m4 < 9) { //0-8秒 个位秒+1 并计算理论分 a('time4').innerHTML = (m4 + 1); Llf(); } else { //当前9秒 个位秒置0 a('time4').innerHTML = 0; //执行十位秒加1操作 time3jia(); } }; //十位秒加 function time3jia() { //分钟60为上限 所有加停止 if (sz(a('time1').innerHTML) == 6) { return; } var m3 = sz(a('time3').innerHTML);//取十位秒 if (m3 < 5) { //0-4秒 十位秒+1 并计算理论分 a('time3').innerHTML = (m3 + 1); Llf(); } else { //当前5秒 十位秒置0 a('time3').innerHTML = 0; //执行个位分加1操作 time2jia(); } }; //个位分加 function time2jia() { //分钟60为上限 所有加停止 if (sz(a('time1').innerHTML) == 6) { return; } var m2 = sz(a('time2').innerHTML);//取个位分 if (m2 < 9) { //0-8分 个位分+1 并计算理论分 a('time2').innerHTML = (m2 + 1); Llf(); } else { //当前9分 个位分置0 a('time2').innerHTML = 0; //执行十位分加1操作 time1jia() } }; //十位分加 function time1jia() { //分钟60为上限 所有加停止 if (sz(a('time1').innerHTML) == 6) { return; } var m1 = sz(a('time1').innerHTML);//取十位分 if (m1 < 6) { //0-5分 十位分+1 a('time1').innerHTML = (m1 + 1); if (sz(a('time1').innerHTML) == 6) { //十位分+1后为上限6 则其它归0 a('time4').innerHTML = 0; a('time3').innerHTML = 0; a('time2').innerHTML = 0; } } Llf();//最后计算理论分 }; //个位秒减 function time4jian() { var m4 = sz(a('time4').innerHTML);//取个位秒 if (m4 > 0) { //个位秒大于0 则-1 并计算理论分 a('time4').innerHTML = (m4 - 1); Llf(); } else { //个位秒为0时 减成9 再执行十位秒减1操作 a('time4').innerHTML = 9; time3jian(); } }; //十位秒减 function time3jian() { var m3 = sz(a('time3').innerHTML);//取十位秒 if (m3 > 0) { //十位秒大于0 则-1 并计算理论分 a('time3').innerHTML = (m3 - 1); Llf(); } else { //十位秒为0时 减成5 再执行个位分减1操作 a('time3').innerHTML = 5; time2jian(); } }; //个位分减 function time2jian() { var m2 = sz(a('time2').innerHTML);//取个位分 if (m2 > 0) { //个位分大于0 则-1 并计算理论分 a('time2').innerHTML = (m2 - 1); Llf(); } else { //个位分为0时 减成9 再执行十位分减1操作 a('time2').innerHTML = 9; time1jian(); } }; //十位分减 function time1jian() { var m1 = sz(a('time1').innerHTML);//取十位分 if (m1 > 0) { //十位分大于0 则-1 并计算理论分 a('time1').innerHTML = (m1 - 1); } else { //当十位分为0时 再减 则全部归0 a('time4').innerHTML = 0; a('time3').innerHTML = 0; a('time2').innerHTML = 0; a('time1').innerHTML = 0; } Llf();//最后计算理论分 }; //循环事件标记变量 var int = 0; //倒计时启动 function qidong() { time4jian(); int = self.setInterval("time4jian()", 1000); a('startbtn').style.display = "none"; a('stopbtn').style.display = ""; }; //倒计时停止 function tingzhi() { window.clearInterval(int); a('startbtn').style.display = ""; a('stopbtn').style.display = "none"; };
<table border="0" width="100%" cellpadding="0" style="border-collapse: collapse" height="100%"> <tr> <td align="right" valign="bottom" class="auto-style1"></td> <td align="center" valign="bottom" class="auto-style1"> <input type="button" value="+" class="shengyu" onClick="time2jia();"></td> <td align="center" valign="bottom" class="auto-style1"> <input type="button" value="+" class="shengyu" onClick="time3jia();"></td> <td align="left" valign="bottom" class="auto-style4"> <input type="button" value="+" class="shengyu" onClick="time4jia();"></td> </tr> <tr> <td align="right" class="auto-style1"> <span id="time1" class="daojishi">2</span> </td> <td align="center" class="auto-style1"> <span id="time2" class="daojishi">0</span> </td> <td align="left" class="auto-style1"> <span class="daojishi">:</span> <span id="time3" class="daojishi">0</span> </td> <td align="left" class="auto-style4"> <span id="time4" class="daojishi">0</span> </td> </tr> <tr> <td align="right" valign="top" class="auto-style1"></td> <td align="center" valign="top" class="auto-style1"> <input type="button" value="-" class="shengyu" onClick="time2jian();"></td> <td align="center" valign="top" class="auto-style1"> <input type="button" value="-" class="shengyu" onClick="time3jian();"></td> <td align="left" valign="top" class="auto-style4"> <input type="button" value="-" class="shengyu" onClick="time4jian();"></td> </tr> </table>