<body>
    <div id="bt1">1</div>
    <div id="bt2">2</div>
    <div id="bt3" onclick="bt3()">3</div>
    <script>
        //1
        let bt1 = document.getElementById("bt1")
        bt1.onclick = function(){
            alert(1)
        }
        //2
        let bt2 = document.getElementById("bt2")
        bt2.addEventListener('click',()=>{alert(2)})
        //3
        function bt3(){
            alert(3)
        }
    </script>
</body>

一时犯浑想不起来了,罪过罪过,记录一下