Home  >  Article  >  Web Front-end  >  How to implement the progress bar function in html5 code? (example)

How to implement the progress bar function in html5 code? (example)

藏色散人
藏色散人Original
2018-08-06 15:46:162555browse

This article mainly introduces how to implement the progress bar function in html5 code. I hope it will be helpful to everyone.

html5 code to implement the progress bar function specific code examples are as follows:

<progress max="100" style="width: 100%" value="0" id="pg"></progress>
/*实现进度条的功能*/ 
<body>
下载进度:
<progress value="22" max="100">
</progress>
</body>

How to implement the progress bar function in html5 code? (example)

/*js代码*/
var pg=document.getElementById(&#39;pg&#39;); 
setInterval(function(e){ 
if(pg.value!=100) pg.value++; 
else pg.value=0; 
},100);

Note: tag definition is running progress (process). You can use the tag to display the progress of time-consuming functions in JavaScript. However, this label is not suitable for representing metrics (for example, disk space usage or query results). To represent weights and measures, use the tag instead.

[Recommended related articles]

Interpretation and analysis of progress bar of WeChat applet component progress

Example to explain Ajax implementation of simple percentage progress Article

Code sharing to implement web page loading progress bar

Introduction to several methods of implementing progress bar in JavaScript


The above is the detailed content of How to implement the progress bar function in html5 code? (example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn