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>