for(o in window){
 alert(o + '\n' + window[o])
}

解决方案 »

  1.   

    奇怪了
    <input type="checkbox" name="base" id="base1" value="1" onClick="javaScript:Checkbase();">1
     <input type="checkbox" name="base" id="base2" value="2" onClick="javaScript:Checkbase();">2
    <script>
    function Checkbase()
    {
    var boxs = document.getElementsByName("base");
    for (elm in boxs)
    {
    alert(elm);
    }
    }
    </script>
    这里返回的是length base base
    但boxs[0] boxs[1]缺是base1 base2的对象
    谁解释一下啊
      

  2.   

    JS没有。
    hansonboy那个是用来遍历对象成员的。
      

  3.   

    for (elm in boxs)
    {
    alert(boxs[elm]);
    }不行再用typeof 判断一下
      

  4.   

    for (elm in boxs)
    {
    alert(boxs[elm].value);
    }
    为什么全都是undefine