菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html><html><head><meta charset="utf-8"></head><body> <form name="display1"> <input type="text" id="box1" name="box1" value="0" size="4" /> <input type="button" value="停止计时" onclick="clearTimeout(meter1)" /> <input type="button" value="继续计时" onclick="count1() " /> </form> <p></p> <form name="display2"> <input type="text" id="box2" name="box2" value="0" size="4" /> <input type="button" value="停止计时" onclick="clearTimeout(meter2) " /> <input type="button" value="继续计时" onclick="count2( ) " /> </form> <script> x = 0; y = 0; function count1( ) { x = x+ 1; document.getElementById("box1").value= x; meter1=setTimeout("count1()", 1000); } function count2( ){ y = y+ 1; document.getElementById("box2").value= y; meter2=setTimeout("count2()", 1000); } count1( ); count2( ); </script></body></html>
运行结果