<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div class="btn">x1</div>
<div class="btn">x2</div>
<div class="btn">x3</div>
<div class="btn">x4</div>
</body>
<script type="text/javascript" >
var x=document.getElementsByClassName("btn").length;
document.write(x);
</script>
</html>
输出结果
x1
x2
x3
x4
4
为何结果不是
4
?
红颜莎娜
ABOUTYOU
精慕HU
慕莱坞森
侃侃尔雅
阿晨1998
相关分类