摘要: <style> body { height: 4000px; } img { position: absolute; height: 70px; width: 70px; transform: translate(-50%, -50%); } </style> <img src="../images 阅读全文
posted @ 2020-06-02 15:42 17135131xjt 阅读(531) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2020.cnblogs.com/blog/1968139/202006/1968139-20200601225132833-1346502352.png) ![](https://img2020.cnblogs.com/blog/1968139/202006/1968139-20200601225407614-800702216.png) 阅读全文
posted @ 2020-06-01 22:55 17135131xjt 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #兼容性问题 e.stopPorpagation() (方法) 或者e.cancelbubble=ture(属性、 ie兼容性用) 阅读全文
posted @ 2020-06-01 20:09 17135131xjt 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #兼容性问题 ie6、7、8识别不出fn(e),只能用windows.event,所以解决兼容性问题可以这样 #1、什么是事件对象 #2、事件对象的使用语法 #3、兼容性问题 #4、事件对象的常见属性和方法 ul.addEventListener('click', fn1); function fn 阅读全文
posted @ 2020-06-01 12:57 17135131xjt 阅读(113) 评论(0) 推荐(0) 编辑
摘要: <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 阅读(161) 评论(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) 编辑