<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>进度条(progress)测试</title> </head> <body> <h2>进度条(progress)测试</h2> <progress value="0" max="100">您的浏览器不支持 HTML5 progress 标签</progress><p> <input type="button" value="开始" onclick="startProgress()"/> <script type="text/javascript"> function startProgress(){ var bar = document.getElementsByTagName("progress")[0]; execProgress(bar, 0); } function execProgress(bar, value){ var value = value+1; bar.value = value; if (value < 100) { setTimeout(function(){execProgress(bar, value);}, 30) }else{ setTimeout(function(){alert("完成")}, 30); } } </script> </body> </html>