Javascript examples for DOM Event:onload
Using getElementsByClassName outside and without "window.onload" event
<html> <head> <script type="text/javascript"> var x=document.getElementsByClassName("myInput"); document.write('Initial: ', x, '<br>'); document.write('Initial Length: ', x.length, '<br>'); /*from w w w . j a v a 2 s .c o m*/ </script> </head> <body> <div class="myInput"></div> <script type="text/javascript"> document.write('Final: ', x, '<br>'); document.write('Final Length: ', x.length, '<br>'); </script> </body> </html>