<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">var currentImgNumber=1;var numberOfImages=3;function window_onload(){setTimeout("switchImage()",3000);}function switchImage(){currentImgNumber++;document.imgAdvert.src='AdvertImage'+currentImgNumber+'.jpg';if(currentImgNumber<numberOfImages){setTimeout("switchImage()",3000);}}</script></head><body onload="window_onload()"><img src="AdvertImage1.jpg" name="imgAdvert" /></body>小弟新手一个,请哪位大佬指点指点!
2 回答
元芳怎么了
TA贡献1798条经验 获得超7个赞
var
currentImgNumber=0;
// 0~2
var
numberOfImages=3;
function
window_onload()
{
setTimeout(
"switchImage()"
,3000);
}
function
switchImage()
{
document.imgAdvert.src=
'AdvertImage'
+(currentImgNumber+1)+
'.jpg'
;
currentImgNumber++;
currentImgNumber %= numberOfImages;
setTimeout(
"switchImage()"
,3000);
}
添加回答
举报
0/150
提交
取消