[问题] 请问javascript自动换图

楼主: ansonrobot (米血哥)   2016-02-24 22:18:38
各位前辈大家好
小弟想用javascript语法写一个可以自动变换图片的效果
但是不知道哪里有问题
是否能请前辈们帮我抓问题
HEAD部分
<script language="javascript1.2">
var b_delay = 1000;
var bannerID;
var b = 0;
var b_links = new Array();
var b_imgs = new Array();
function LoadB_Imgs(b,img_file){
b_image = new Image();
b_image.src = img_file;
b_imgs[b] = b_image.src;
}
LoadB_Imgs(0,"photo/banner.jpg");
LoadB_Imgs(1,"photo/banner01.jpg");
LoadB_Imgs(2,"photo/banner02.jpg");
LoadB_Imgs(3,"photo/banner03.jpg");
function RotateBanner(){
document.as.src = b_imgs[b];
if(b >= 3){
b = 0;
}
else{
b++;
}
bannerID = setTimeout("RotateBanner()",b_delay);
}
function LoadFunctions(){
RotateBanner();
}
</script>
BODY部分
<body>
onload = "LoadFunctions()";
<img name="as" src="photo/banner.jpg" width="30%">
</body>
作者: swallowcc (guest)   2016-02-24 22:27:00
<body onload = "LoadFunctions()">
楼主: ansonrobot (米血哥)   2016-02-24 23:11:00
感谢前辈的帮助,效果有跑出来

Links booklink

Contact Us: admin [ a t ] ucptt.com