圖片隨機切換代碼

字號:


    代碼如下:
    <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=;
    alt=ad1;
    banner=圖片/01.jpg;
    width=440;
    height=230;
    }
    if (ad==2) {
    url=;
    alt=ad2;
    banner=圖片/02.jpg;
    width=440;
    height=230;
    }
    if (ad==3) {
    url=;
    alt=ad3;
    banner=圖片/03.jpg;
    width=440;
    height=230;
    }
    if (ad==4) {
    url=;
    alt=ad4;
    banner=images/04.jpg;
    width=440;
    height=230;
    }
    if (ad==5) {
    url=;
    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>