<script type="text/javascript"> countBodyChildren() { var body_element = document.getElementsByTagName("body")[0]; alert(body_element.childNodes.length); } window.onload = countBodyChildren; </script>
1 回答
DIEA
TA贡献1820条经验 获得超2个赞
函数声明语句写错了,哪能这么搞
var countBodyChildren = function() {
var body_element = document.getElementsByTagName("body")[0];
alert(body_element.childNodes.length); };
添加回答
举报
0/150
提交
取消