html5 progress

2021-11-08 11:32:16 浏览数 (2)

代码语言:javascript复制
            <section>
                <h2>进度 Progress</h2>
                <p>进度: <progress id="p" value="0" max=100><span>0</span>%</progress></p>
                <script>
                
                window.onload=function(){
                    var progressBar = document.getElementById('p');
                var newValue=0;
                        function updateProgress() {
                newValue =10;
                    progressBar.value = newValue;
                                        console.log(newValue);
                progressBar.getElementsByTagName('span')[0].textContent = newValue;
                if(newValue=="100"){
                
                
                clearInterval(up)
                }
                
                }
                        var up = window.setInterval(updateProgress, 500);
                }
                    
                </script>
            </section>

0 人点赞