From 89ca07c60d201c964100c5781d7492a65b2f8605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=96=E6=B6=9B?= <2124876211@qq.com> Date: Fri, 18 Nov 2022 11:51:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9E=97=E4=B8=96=E6=B6=9B?= 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" | 80 +++++++++++++++++ .../\347\254\224\350\256\260/2022.11.18.md" | 85 +++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 "23\346\236\227\344\270\226\346\266\233/\344\275\234\344\270\232/2022.11.18\344\275\234\344\270\232.html" create mode 100644 "23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18.md" diff --git "a/23\346\236\227\344\270\226\346\266\233/\344\275\234\344\270\232/2022.11.18\344\275\234\344\270\232.html" "b/23\346\236\227\344\270\226\346\266\233/\344\275\234\344\270\232/2022.11.18\344\275\234\344\270\232.html" new file mode 100644 index 0000000..8e79ead --- /dev/null +++ "b/23\346\236\227\344\270\226\346\266\233/\344\275\234\344\270\232/2022.11.18\344\275\234\344\270\232.html" @@ -0,0 +1,80 @@ + + + + + + + Document + + + +
+ +
+ + //SomeJavaScriptCode:规定该事件发生时执行的 JavaScript +//JavaScript +object.onclick=function(){SomeJavaScriptCode}; +``` + + + +**document.getElementById()**:查找文档特定元素 + +**getElementsByTagName()**:获取任何类型的 HTML 元素的列表,不区分大小写 + +```js +var tables = document.getElementsByTagName("table"); +alert ("This document contains " + tables.length + " tables"); +//也可以获取文档中特定元素 +var myParagragh = document.getElementsByTagName("p")[3]; +``` + +##### 修改元素样式 + +```js +//修改td1的字体颜色 +'td1'.style.color = '#FF5072' +//修改td1的背景颜色 +'td1'.style.backgroundColor = 'white'; +``` + +**修改文档某元素的文本内容** + +```js +document.getElementById('pOutput').innerText = \ No newline at end of file -- Gitee From f06d5a6b6cb2e74a5aa940b08b8dd372fa665015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=96=E6=B6=9B?= <2124876211@qq.com> Date: Fri, 18 Nov 2022 03:53:04 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=2023=E6=9E=97?= =?UTF-8?q?=E4=B8=96=E6=B6=9B/=E7=AC=94=E8=AE=B0/2022.11.18.md=20=E4=B8=BA?= =?UTF-8?q?=2023=E6=9E=97=E4=B8=96=E6=B6=9B/=E7=AC=94=E8=AE=B0/2022.11.18?= =?UTF-8?q?=E7=AC=94=E8=AE=B0.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022.11.18\347\254\224\350\256\260.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18.md" => "23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18\347\254\224\350\256\260.md" (100%) diff --git "a/23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18.md" "b/23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18\347\254\224\350\256\260.md" similarity index 100% rename from "23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18.md" rename to "23\346\236\227\344\270\226\346\266\233/\347\254\224\350\256\260/2022.11.18\347\254\224\350\256\260.md" -- Gitee