From d188b4aeddeab8162eb56ff33cd889b14c5ca01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E5=BE=B7=E6=A3=AE?= <1500225483@qq.com> Date: Mon, 21 Nov 2022 09:01:10 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=BB=BA=202022-11-21-innerHTML?= =?UTF-8?q?=E5=92=8CinnerText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-11-21-innerHTML\345\222\214innerText/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/.keep" diff --git "a/47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/.keep" "b/47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From ebc7b3cabe971eb9d0ab217b1288bfb552bf8227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E5=BE=B7=E6=A3=AE?= <1500225483@qq.com> Date: Mon, 21 Nov 2022 09:01:55 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=BE=E5=BE=B7=E6=A3=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 曾德森 <1500225483@qq.com> --- .../\347\254\224\350\256\260.md" | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 "47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/\347\254\224\350\256\260.md" diff --git "a/47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/\347\254\224\350\256\260.md" "b/47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/\347\254\224\350\256\260.md" new file mode 100644 index 0000000..29b5786 --- /dev/null +++ "b/47\346\233\276\345\276\267\346\243\256/2022-11-21-innerHTML\345\222\214innerText/\347\254\224\350\256\260.md" @@ -0,0 +1,54 @@ +### innerHTML 和 innerText + +innerHTML:获取时会将标签一起获取 + +innerText:只会获取纯文本,不能解析标签 + + + +//获取输入框的值 + +`var input=document.queryselector('input');` //获取输入框里的值 + +`var div=document.getelementByid('box')` //获取text框 + +`function getvalue(){` + + `console.log(input.value);` + + `div.innerHTML='
| + 全选 + 反选 + | +姓名 | +性别 | +专业 | +爱好 | +
|---|---|---|---|---|
| + | 刘备 | +男 | +软件开发 | +抽烟 | +
| + | 关羽 | +男 | +国际贸易 | +喝酒 | +
| + | 张飞 | +男 | +园林设计 | +烫头发 | +
| + | 赵云 | +男 | +平面设计 | +抽烟 | +
| + | 黄忠 | +男 | +影视制作 | +玩游戏 | +
| + | 小乔 | +女 | +高级护理 | +唱歌 | +