请教js的for in的用法
<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(boxs[elm].value);
}
}
</script>
为什么全都是undefine
而不是value呢
------解决方案--------------------恩,調試下是很奇怪,爲何elm除了length之外,不是base1 base2,而都是base