Javascript examples for Browser Object Model:Window Load
Assign function to window.onload
<html> <head> <script> function LoadArray(){/*from w ww . j a v a 2s . c o m*/ var randomnumber=new Array(); for(var i=0; i<=10; i++) { randomnumber[i]=Math.random(); } document.getElementById("h_field").value = randomnumber[0]; } window.onload = LoadArray; </script> </head> <body> <form id="myform" action="b.php" method="GET"> <input type="hidden" id="h_field" name="h_field"> <input type="Submit" value="my button"> </form> </body> </html>