为什么是七个孩子?container中的childnodes个数为什么不是3而是7?

<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>

<script type="text/javascript">
function countDiv(){
var obj_div = document.getElementById('container');
var cn =obj_div.childNodes.length

</script>
<body>

<div id="container">
<div id="1">
    <table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="9%" rowspan="2">
<div align="center">1</div>
</td>
    <td width="30%" rowspan="2">
<div align="center"><span class="zhuanji_box"><a href="#"></a></span><img src="s/pic_106-106.gif" width="106" height="106" /></div>
</td>
    <td width="25%"></td>
    <td width="36%">&nbsp;</td>
    </tr>
    <tr>
    <td><span class="lh18">创 建 人:1<br />
播放次数:1次<br />
视 频 数:29<br />
播放时间:2009-10-22</span></td>
    <td><img alt="Icon_digg" src="../My Documents/icon_digg.gif" width="13" height="8" title="上移"  onclick="upmove('1');"/>
    <img alt="Icon_bury" src="../My Documents/icon_bury.gif" width="13" height="8" title="下移"  onclick="downmove('1');"/>
    <img src="del.gif" width="7" height="7" title="删除"  onclick="delVideo('1');"/></td>
    </tr>
</table>
</div>





<div id="2">
    <table width="80%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="9%" rowspan="2"><div align="center">2</div></td>
    <td width="30%" rowspan="2"><div align="center"><span class="zhuanji_box"><a href="#"><img src="pic_80-60.gif" width="80" height="60" /></a></span></div></td>
    <td width="25%"></td>
    <td width="36%">&nbsp;</td>
  </tr>
  <tr>
    <td><span class="lh18">创 建 人:2<br />
播放次数:2次<br />
视 频 数:29<br />
播放时间:2009-10-22</span></td>
    <td><img   alt="Icon_digg" src="../My Documents/icon_digg.gif" width="13" height="8" title="上移"  onclick="upmove('2');"/>
<img  alt="Icon_bury" src="../My Documents/icon_bury.gif" width="13" height="8" title="下移"  onclick="downmove('2');"/>
<img src="del.gif" width="7" height="7" title="删除"  onclick="delVideo('2');"/></td>
    </tr>
</table>
</div>







<div id="3">
    <table width="80%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="9%" rowspan="2"><div align="center">3</div></td>
    <td width="30%" rowspan="2"><div align="center"><span class="zhuanji_box"><a href="#"></a></span><img src="pic_152-114.gif" width="152" height="114" /></div></td>
    <td width="25%"></td>
    <td width="36%">&nbsp;</td>
  </tr>
  <tr>
    <td><span class="lh18">创 建 人:3<br />
播放次数:3次<br />
视 频 数:29<br />
播放时间:2009-10-22</span></td>
    <td><img  alt="Icon_digg" src="../My Documents/icon_digg.gif" width="13" height="8" title="上移"  onclick="upmove('3');" />
<img alt="Icon_bury" src="../My Documents/icon_bury.gif" width="13" height="8" title="下移"   onclick="downmove('3');"/>
<img src="del.gif" width="7" height="7" title="删除"  onclick="delVideo('3');"/></td>
    </tr>
</table>
</div>

</div>
<input value="显示" type="button" onclick="countDiv()"   title="显示"/></button>
</body>
</html>

你可能感兴趣的:(html,jsp,XHTML)