主要通过document.getElementsByTagName取值后插入
代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div></div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div></div>
<div></div>
<div></div>
</body>
<script>
let div2 = document.getElementsByTagName('div')[1];
let divsmall = div2.getElementsByTagName('div');
for (let i = 0; i < divsmall.length; i++) {
divsmall[i].innerHTML += "aaaaa"
}
</script>
</html>