<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无题</title>
<script type="text/javascript">
window.onload=function(){
var x=document.getElementsByName("test");
x[0].onClick=function(){
alert(x.length);
}
}
</script>
</head>
<body>
<input name="test" type="button" value="弹出窗口"/>
</body>
</html>
为什么这段代码不能弹出x的长度1