执行脚本的时候,form id="form" 这个还没有加载
当然显示null了

解决方案 »

  1.   

    在<script>上加一个defer<HTML>
    <HEAD><title>地区连动</title>
    </HEAD>
    <body>
    <script language="javascript" defer>
    var a=document.all("form");
    alert(a)
    </script>
    <table width="200" border="0" cellspacing="0" cellpadding="0">
    <form id="form">
    <tr>
    <td><select id="city1" name="city1"><option>fasdf</select></td>
    <td><select id="city2"></select></td>
    <td><select id="city3"></select></td>
    </tr>
    </form>
    </table>
    </body>
    </HTML>