html5 progress

html5 progress

            <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>
来都来了,留个言吧🙂