-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOM_innerHTML.html
More file actions
37 lines (32 loc) · 1.1 KB
/
DOM_innerHTML.html
File metadata and controls
37 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!--
* @由于个人水平有限, 难免有些错误, 还请指点:
* @Author: cpu_code
* @Date: 2020-10-20 21:14:38
* @LastEditTime: 2020-10-20 21:17:53
* @FilePath: \web\javascript\DOM_innerHTML\DOM_innerHTML.html
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
* @Github: [http://github.com/CPU-Code](http://github.com/CPU-Code)
* @CSDN: [https://blog.csdn.net/qq_44226094](https://blog.csdn.net/qq_44226094)
* @Gitbook: [https://923992029.gitbook.io/cpucode/](https://923992029.gitbook.io/cpucode/)
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HTMLDOM</title>
</head>
<body>
<div id="div1">
div cpucode
</div>
<script>
var div = document.getElementById("div1");
var innerHTML = div.innerHTML;
document.write(innerHTML);
//div标签中替换一个文本输入框
div.innerHTML = "<input type='text'>";
//div标签中追加一个文本输入框
div.innerHTML +="<input type='text'>"
</script>
</body>
</html>