有这样一句代码:var Dtr = document.getElementsByTagName("tr");
alert(Dtr.length);
怎么打印不出Dtr的数量?请高人帮我解决,谢谢!

解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>bbbbbbbbbbbbbbbbb</title>
    <script language="javascript">
    </script>
    </head><body>
    <script type="text/javascript"></script>
    <form name="form1" id="form1" action="b.asp" method="post">
    <input name="submit" type="button" value="提交" onclick="sub_form(this.form);"/>
    <input type="text" name="T1" id="T1" size="20">
    <input type="button" value="提交" name="B1" onclick="funcc()">
    <table>
    <tr>
    <td><input type="checkbox" onclick="func1(alert(this.rows[0].cellIndex))">
    </td>
    <td><input type="checkbox" onclick="func1()">
    </td>
    </tr>
    <tr>
    <td><input type="checkbox">
    </td>
    <td><input type="checkbox">
    </td>
    </tr>
    </table><input type=checkbox name=chk1 Id=1>
    <input type=checkbox name=chk1 Id=1>
    <br>
    全:
    <input type=checkbox onclick=sel(1)><input type=checkbox name=chk2 Id=2>
    <input type=checkbox name=chk2 Id=2>
    <br>
    全:<input type=checkbox onclick=sel(2)>
    </form>
    <div id=test1 style='display=none'>
    <table width="600" border="0" >
    <tr class="image_p_row">
    <td width="25%">111</td>
    </tr>
    </table>
    </div><script language=javascript>var Dtr = document.getElementsByTagName("tr");
    alert('????');
    alert(Dtr.length);
    </script>
    </body>
    </html>