Home > Web Front-end > HTML Tutorial > How to implement progress bar in html

How to implement progress bar in html

青灯夜游
Release: 2023-01-06 11:13:36
Original
19246 people have browsed it

In HTML, you can use the progress tag to implement a progress bar. This tag can define the progress of a running task (process). Use the syntax "".

How to implement progress bar in html

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

tag defines the progress (process) of a running task.

下载进度:
<progress value="22" max="100">
</progress>
Copy after login

Rendering:

How to implement progress bar in html

Description: The tag can be used with JavaScript to dynamically display the progress of the task.

<progress id=&#39;progress1&#39; value="0" max="100">
</progress>
<button onclick="start_run(100)">下载</button>
<script>
function start_run(n)
{
    if(n==0){alert("下载完成")}
    var progress1=document.getElementById("progress1")
    n=n-1
    cur_task=100-n
    progress1.value=cur_task
    setTimeout("start_run("+n+")",100)
    
}
</script>
Copy after login

Rendering:

How to implement progress bar in html

How to implement progress bar in html

##For more programming-related knowledge, please visit:

Programming video! !

The above is the detailed content of How to implement progress bar in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template