上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 44 下一页
摘要: DOM重点核心-基础 获取元素有哪两种方法方法? 1 利用DOM提供的方法获取元素。 document.getElementbyId(),document.getELmenntbyTagName() document,getElementsByClassName('') document.query 阅读全文
posted @ 2022-04-18 11:28 罗砂 阅读(40) 评论(0) 推荐(0)
摘要: document.write(); element.innerHTML; document.createElement(); 区别 document.write是直接将内容写入页面的内容流,但是文档流执行完毕,则它会导致页面全部重绘 innerHTML是将内容写入某个DOM节点,不会导致页面全部重绘 阅读全文
posted @ 2022-04-18 11:27 罗砂 阅读(29) 评论(0) 推荐(0)
摘要: <style> * { padding: 0; margin: 0; } table { width: 500px; margin: 100px auto; border-collapse: collapse; /*边框合并模式*/ text-align: center; } td, th { bo 阅读全文
posted @ 2022-04-18 11:26 罗砂 阅读(97) 评论(0) 推荐(0)
摘要: 复制节点 node.cloneNode() node.cloneNode()方法返回调用该方法的节点的一个副本。也称为克隆节点/拷贝节点 <body> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </body> <script> let ul = docu 阅读全文
posted @ 2022-04-18 11:25 罗砂 阅读(66) 评论(0) 推荐(0)
摘要: 当我们把文本域里面的值赋值给li的时候,多添加一个删除的链接 需要把所有链接获取过来,当我们点击当前的链接的时候,删除当亲链接所在的li 阻止链接跳转需要添加JavaScript:void(0);或者JavaScript:; <body> <button>删除</button> <ul> <li>张 阅读全文
posted @ 2022-04-18 11:24 罗砂 阅读(60) 评论(0) 推荐(0)
摘要: 添加节点 1. node.appendChild(child) node.appendChild( ) 方法将一个节点添加到指定父节点列表末尾。类似于css里面的after <body> <ul> <li>123</li> </ul> </body> <script> // 1.创建节点元素节点 v 阅读全文
posted @ 2022-04-18 11:23 罗砂 阅读(86) 评论(0) 推荐(0)
摘要: <style> ul { list-style: none; } ul li { background-color: pink; line-height: 40px; margin: 10px; width: 300px; } ul li a { color: red; float: right; 阅读全文
posted @ 2022-04-18 11:23 罗砂 阅读(97) 评论(0) 推荐(0)
摘要: <body> <ul> <li id="top">微博</li> <li class="hide">私信</li> <li class="hide">评论</li> <li class="hide">@我</li> </ul> </body> <script> // 大概方法: // 1.获取元素 阅读全文
posted @ 2022-04-18 11:21 罗砂 阅读(74) 评论(0) 推荐(0)
摘要: <body> <div>我是div</div> <span>我是span</span> </body> <script> var div = document.querySelector("div"); // 1.nextSibling 下一个兄弟节点 包含节点或者 文本节点等等 console.l 阅读全文
posted @ 2022-04-18 11:21 罗砂 阅读(70) 评论(0) 推荐(0)
摘要: <body> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> </body> <script> let ul = document.querySelector("ul"); // 2.children 实际开发的写法 阅读全文
posted @ 2022-04-18 11:20 罗砂 阅读(42) 评论(0) 推荐(0)
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 44 下一页