1、在body中用onload:
<body onload="conver()">
2、在脚本中用window.onload:
<script type="text/javascript">
window.onload=about;//不要括号
function about()
{
var beatles=Array("1","2","3","4");
for(var count=0;count<beatles.length;count++)
{
alert(beatles[count]);
}
}
3.使用window.onload=function(){}进行加载
<script type="text/javascript">
window.onload=function(){
var beatles=Array("1","2","3","4");
for(var count=0;count<beatles.length;count++)
{
alert(beatles[count]);
}
}
</script>