<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>定时器</title>
</head>
<body>
<button id="bt1">终止输出hello world</button>
<button id="bt2">重启t1</button>
<script>
var t1=setInterval(function(){
console.log("hello world")
},3000)
var t2=setInterval(function(){
console.log("你好 世界")
},3000)
var bt1=document.getElementById("bt1")
bt1.οnclick=function(){
clearInterval(t1)
}
var bt2=document.getElementById("bt2")
bt2.οnclick=function(){
t1=setInterval(function(){
console.log("hello world")
},3000)
}
</script>
</body>
</html>
定时器..
最新推荐文章于 2024-10-07 09:24:46 发布