AI智能
改变未来

js写计时器

<!DOCTYPE html><html leng = \'en\'><head><meta charset = \'UTF-8\'/><style>input{border:1px solid rgba(0,0,0,0,8);text-align:right;font-size:20px;font-weight:bold;}</style></head><body>minutes:<input type = \'text\' value = \'0\'>seconds:<input type = \'text\' value = \'0\'><script>var input1 = document.getElementsByTagName(\'input\')[0];var input2 = document.getElementsByTagName(\'input\')[1];var timer = setInterval(function (){if(Number(input1.value) != 3){if(Number(input2.value) < 59){input2.value = Number(input2.value) +1;}else{input2.value = 0;input1.value = Number(input1.value) +1;}}else{clearInterval(timer);}},100);</script></body></html>

		
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » js写计时器