感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<h1></h1>
<div id="myProgress">
<div id="myBar"></div>
</div>
<br>
<button onclick="move()">点我</button>
xxxxxxxxxx
var id = null;
function move() {
var elem = document.getElementById("myBar");
var width = 1;
// clearInterval(id);
if(!id){
id = setInterval(frame, 10);
function frame() {
if (width > 100) {
clearInterval(id);
id = null;
} else {
width++;
elem.style.width = width + '%';
}
#myProgress {
width: 100%;
background-color: #ddd;
#myBar {
width: 1%;
height: 30px;
background-color: #4CAF50;