多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
本demo只需要一个文件 ```ppp <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <script> function setfile(){ var fd = new FormData; var pic = document.getElementsByTagName('input')[0].files[0]; fd.append('pic',pic); var xhr = new XMLHttpRequest(); xhr.open('POST','59.php',true); xhr.upload.onprogress = function(ev){ if(ev.lengthComputable){ var percent = 100 * ev.loaded / ev.total; document.getElementById('bar').style.width = percent + '%'; document.getElementById('bar').innerHTML = percent + '%'; } } xhr.send(fd); } </script> <style> #progress{width:500px;height:30px;border:1px solid green;} #bar{width:0%;height:100%;background:green;} </style> <body> <input type="file" name="pic" onchange="setfile()"> <h1>上传进度条</h1> <div id="progress"> <div id="bar"></div> </div> </body> </html> ```