As you can see below,it will run without 'window.onload
' and var x is '[<div class="myInput"></div>]
',but not '[]
'.
<html>
<head>
<script type="text/javascript">
var x=document.getElementsByClassName("myInput");
</script>
</head>
<body>
<div class="myInput"></div>
</body>
</html>
how and when it put the element into the array?