新的一天

This commit is contained in:
syx_computer
2025-10-15 17:48:32 +08:00
parent 61ec7c9468
commit 8150aa63d1
8 changed files with 239 additions and 231 deletions

View File

@@ -11,7 +11,25 @@
<input type="button" id="btn2" value="点我一下试试2">
<script>
//事件监听
// 1. 事件监听
// 事件源.事件类型 = 事件处理函数
// 事件源.事件类型 = function () {
// 事件处理代码
// }
// document.querySelector('#btn1').addEventListener('click', function () {
// console.log("试试就试试");
// })
//事件监听 可多次绑定同一事件
document.querySelector('#btn1').addEventListener('click', () => {
console.log("试试就试试");
})
//事件绑定早期写法 如果多次绑定 后绑定的会覆盖先绑定的
document.querySelector('#btn2').onclick = function () {
console.log("试试就试试2");
}
</script>
</body>
</html>