简单用法
var interalFunc
function myFunction(){
interalFunc = setInterval(alerFunc,3000)
}
function alertFunc(){
alert('hello zf')
}
清除计时器,计时器必须要有一个变量名
var myInterval = setInterval(alert('hello Mcdonald',3000))
clearInterval(myInterval)
window.onload = function move(){
let ele = document.getElementById('moveBar')
let width = 0
let moveInterval = setInterval(frame,1000)
function frame(){
if(width === 500){
clearInterval(moveInterval)
}else{
width++
ele.style.width=width+'%'
ele.innerText = width+'%'
}
}
}