1、在body中用onload: <body onload="conver()"> 2、在腳本中用window.onload: <script type="text/javascript"> window.onload=about;//不要括弧function about(){ var beatle
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>