SOURCE

console 命令行工具 X clear

                    
>
console
<html>
    <head></head>
    <body>
        
        <button>按钮1</button>
        <button>按钮2</button>

        <style>
            button{
                position:absolute;
            }
        </style>
    </body>


    <script>
        let btn = document.querySelectorAll('button')
        btn.forEach((item)=>{
            let left = 1
                let isInterVal = false
            item.addEventListener('click',()=>{
                if(!isInterVal){
                    isInterVal = true
                    setInterval(()=>{
                    item.style.left = left ++ + 'px'
                    console.log('23')
                    },500)
                }
                
                
            })
        })

    </script>
</html>