网站制作学习网JS脚本→正文:图片随机切换代码
字体:

图片随机切换代码

JS脚本 2008/2/16 8:25:18  点击:不统计

<script language="JavaScript">



var how_many_ads = 5

var now = new Date()

var sec = now.getSeconds()

var ad = sec % how_many_ads;

ad +=1;



if (ad==1){

url="http://www.forasp.cn";

alt="ad1";

banner="图片/01.jpg";

width="440";

height="230";

}



if (ad==2) {

url="http://www.forasp.cn";

alt="ad2";

banner="图片/02.jpg";

width="440";

height="230";

}



if (ad==3) {

url="http://www.forasp.cn";

alt="ad3";

banner="图片/03.jpg";

width="440";

height="230";

}



if (ad==4) {

url="http://www.forasp.cn";

alt="ad4";

banner="images/04.jpg";

width="440";

height="230";

}



if (ad==5) {

url="http://www.forasp.cn";

alt="ad5";

banner="图片/05.jpg";

width="440";

height="230";

}



document.write('<center>');

document.write('<a href=\"' + url + '\" target=\"_blank\">');

document.write('<img src=\"' + banner + '\" width=')

document.write(width + ' height=' + height + ' ');

document.write('alt=\"' + alt + '\" border=0>

');

document.write('</center>');

--></script>

·上一篇:JS屏蔽鼠标右键 >>    ·下一篇:常用Javascript语句1 >>
推荐文章
最新文章