<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>文档</title>
</head>
<body>
<div id="parent-id">
<p>你好世界 1</p>
<p id="test1">你好世界 2</p>
<p>你好世界 3</p>
<p>你好世界 4</p>
</div>
<script>
const parentDOM = document.getElementById("parent-id");
const test1 = parentDOM.getElementById("test1");
// 抛出错误
// Uncaught TypeError: parentDOM.getElementById is not a function
</script>
</body>
</html>
01-18
1705
11-10
163
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交