时间:2021-07-01 10:21:17 帮助过:8人阅读
1.效果
2.源码
<html> <head> <script type="text/javascript"> window.onload = function () { var myProgress = document.getElementById("myProgress"); var mySpan = document.getElementById("mySpan"); var value = myProgress.value; mySpan.innerText = value + "%"; var ID = setInterval(function () { value = myProgress.value; if (value < 100) { value += 10; myProgress.value = value; mySpan.innerText = value + "%"; } if (value == 100) { clearInterval(ID); } }, 500); } </script> </head> <body> <label for="myProgress">进度条</label> <progress id="myProgress" value="0" max="100"></progress> <span id="mySpan"></span> </body> </html>
相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!
推荐阅读:
对angular2与共享模块进行应用
Vue+Nuxt.js做出服务端渲染
以上就是使用JS做出动画进度条功能的详细内容,更多请关注Gxl网其它相关文章!