这是我的脚本,它按预期工作,但通过使用 jQuery 淡入/淡出,我还想在图像之间淡入淡出,而不会对我的脚本进行太多更改。
<script language="JAVASCRIPT" type="text/javascript">
var ads = new Array();
ads[1] = new Image ();
ads[2] = new Image ();
ads[3] = new Image ();
ads[4] = new Image ();
ads[1].src = "images/fender.jpg" ;
ads[2].src = "images/gibson.jpg" ;
ads[3].src = "images/marshall.jpg" ;
ads[4].src = "images/laney.jpg" ;
var timing = new Array();
timing[1] = 2500 ;
timing[2] = 2500 ;
timing[3] = 2500 ;
timing[4] = 2500 ;
var sites = new Array();
sites[1] = "http://www.fender.co.uk";
sites[2] = "http://www2.gibson.com";
sites[3] = "http://www.marshallamps.com";
sites[4] = "http://www.laney.co.uk";
var adnumber = 0;
var totalAds = ads.length - 1;
var timerID = "";
function startBanner (){
adnumber = 0;
showAd();
}
function showAd() {
if (document.images){
if (document.myBanner.complete){
adnumber++;
(adnumber > totalAds) ? adnumber=1 : adnumber=adnumber;
document.myBanner.src = ads[adnumber].src;
}
timerID = setTimeout("showAd()",timing[adnumber]);
}
}
function goSite(){
clearTimeout(timerID);
window.location.href = sites[adnumber];
}
</script>
一些指导会很棒,谢谢,Finbar