第一种
</div>
</div>
<br>
<button onclick="eat()">点击</button>
<script>
// console.log(document.getElementById(“btn”));
function eat() {
var _width= document.getElementsByClassName("main1")[0];
var width = 0;
var id = setInterval(foot, 100);
function foot() {
if (width == 500) {
clearInterval(id);
}
else {
width +=5;
_width.style.width = width +"px";
}
}
}
</script>
第二种
JavaScript 进度条
点我
第三种