"."/> ".">

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

How to implement progress bar in html

青灯夜游
青灯夜游Original
2021-05-17 14:54:1819213browse

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>

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>

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!

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
Previous article:How to set style in htmlNext article:How to set style in html