From 06a2572b3b741ae822ee2f52189ee9ccd03632d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E6=B2=BB=E5=85=88?= <1930069369@qq.com> Date: Sun, 20 Nov 2022 14:25:34 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=83=E6=AC=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖治先 <1930069369@qq.com> --- .../2022-11-18\344\275\234\344\270\232.html" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" diff --git "a/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" new file mode 100644 index 0000000..0c49321 --- /dev/null +++ "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" @@ -0,0 +1,60 @@ + + + + + + + Document + + + + + + +
+
+ +
+ +
+
+
+ + \ No newline at end of file -- Gitee From 781601c9a2b138a452abbc53fb1ca37a240f0be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E6=B2=BB=E5=85=88?= <1930069369@qq.com> Date: Sun, 20 Nov 2022 14:27:21 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=83=E6=AC=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖治先 <1930069369@qq.com> --- ...\350\256\260 \346\240\207\347\255\276.md" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-11-18\347\254\224\350\256\260 \346\240\207\347\255\276.md" diff --git "a/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-11-18\347\254\224\350\256\260 \346\240\207\347\255\276.md" "b/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-11-18\347\254\224\350\256\260 \346\240\207\347\255\276.md" new file mode 100644 index 0000000..473b1f6 --- /dev/null +++ "b/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-11-18\347\254\224\350\256\260 \346\240\207\347\255\276.md" @@ -0,0 +1,29 @@ +1.html元素获取 + +``` +//根据class获取元素: 返回: HTMLCollection (数组) + console.log(document.getElementsByClassName('H2')); +//根据name属性获取元素对象: NodeList(伪数组):只能获取下标和长度 + console.log(document.getElementsByName('username')); +//根据标签名获取元素对象:返回 HTMLCollection + console.log(document.getElementsByTagName('input')); +//根据id属性获取元素对象,返回当前元素对象 + console.log(document.getElementById('thirdH2')); +//id或class,获取元素对象 +console.log(document.querySelector('.class名'));//.获取class对象元素 +console.log(document.querySelector('#id名'));//#获取id对象元素 +``` + +2.元素节点 + +``` +//创建元素节点 + var 元素对象 = document.createElement('h2'); + var txt = document.createTextNode('文本内容'); + 元素对象.appendChild(txt); +// 添加子元素节点 + div.appendChild(newH2); +//删除子节点:removeChild(元素对象) +//改:replaceChild(元素对象(新),元素对象(旧)) +``` + -- Gitee From a16ce9157c999f16055097ca7b094ad8dc64d4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E6=B2=BB=E5=85=88?= <1930069369@qq.com> Date: Sun, 20 Nov 2022 14:48:18 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2007?= =?UTF-8?q?=20=E5=BB=96=E6=B2=BB=E5=85=88/=E4=BD=9C=E4=B8=9A/2022-11-18?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-11-18\344\275\234\344\270\232.html" | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 "07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" diff --git "a/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" deleted file mode 100644 index 0c49321..0000000 --- "a/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - Document - - - - - - -
-
- -
- -
-
-
- - \ No newline at end of file -- Gitee From bcce6f8ea26fb993d20ad1d1257f2150771b517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E6=B2=BB=E5=85=88?= <1930069369@qq.com> Date: Sun, 20 Nov 2022 14:48:33 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=83=E6=AC=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖治先 <1930069369@qq.com> --- .../2022-11-18\344\275\234\344\270\232.html" | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 "07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" diff --git "a/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" new file mode 100644 index 0000000..5df067b --- /dev/null +++ "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-11-18\344\275\234\344\270\232.html" @@ -0,0 +1,61 @@ + + + + + + + Document + + + + + + +
+
+ +
+ +
+
+
+ + \ No newline at end of file -- Gitee