为什么这个弹出的数组长度是undefined
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<script type='text/javascript'>
function allSelect(){
var form = document.forms[0];
alert(form);
var state = form.allselectbox.checked;
alert(state);
var length = form.usernames.length;
alert(form.usernames.length);
}
</script>
<BODY>
<form name="buyerForm" method="post" action="/mysport/control/user/list.do">
<input type="checkbox" name="usernames" value="testtest">testtest<br>
<input type="checkbox" onclick="javascript:allSelect()" name="allselectbox">??
</form>
</BODY>
</HTML>
上边的HTML中,应该是数组长度是1吧,那不有一个名为usernames的复选框吗?为什么最后弹出的却是undefined?
------解决方案--------------------