摘要: <div class="father"> <div class="son">son盒子</div> </div> </div> <script> // DOM事件流 三个阶段 // 1、js代码中只能执行捕获或者冒泡其中的一个阶段 // 2、onclick和attachEvent(ie)只能得到冒泡 阅读全文
posted @ 2020-05-31 20:52 17135131xjt 阅读(158) 评论(0) 推荐(0) 编辑
摘要: var divs = document.querySelectorAll('div'); // 1、传统方式解除事件 this.onclick = null; divs[0].onclick = function () { alert('hello'); this.onclick = null; } 阅读全文
posted @ 2020-05-31 20:44 17135131xjt 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #例 #监听事件方法 #addEventListener()方法兼容性改变方法 var btns = document.querySelectorAll('button'); // 1、传统方式注册事件 btns[0].onclick = function () { alert('你好'); } / 阅读全文
posted @ 2020-05-31 18:57 17135131xjt 阅读(162) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2020.cnblogs.com/blog/1968139/202005/1968139-20200531173815340-1734005278.png) 阅读全文
posted @ 2020-05-31 18:26 17135131xjt 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #创建元素 #增加元素 #删除元素 #改元素 #查元素 #属性操作 #事件操作 阅读全文
posted @ 2020-05-31 17:34 17135131xjt 阅读(96) 评论(0) 推荐(0) 编辑
摘要: // document.write() // var btn = document.querySelector('button'); // btn.onclick = function () { // // 1、document.write() // // document.write 如果页面文档 阅读全文
posted @ 2020-05-31 16:11 17135131xjt 阅读(141) 评论(0) 推荐(0) 编辑