首頁圖片翻頁效果

來源:互聯網
上載者:User

按規定時間一幅一幅分別顯示,並同時顯示標題或內容簡介。
代碼如下:

JS:(以最新4幅圖片為例)
<script language="JavaScript">
var imgUrl=new Array();
var imgLink=new Array();
var imgText=new Array();
var picNum=0;
imgUrl[1]="圖片地址1";
imgLink[1]="連結1";
imgText[1]="標題或簡介或其它HTML內容1";
imgUrl[2]="圖片地址2";
imgLink[2]="連結2";
imgText[2]="標題或簡介或其它HTML內容2";
imgUrl[3]="圖片地址3";
imgLink[3]="連結3";
imgText[3]="標題或簡介或其它HTML內容3";
imgUrl[4]="圖片地址4";
imgLink[4]="連結4";
imgText[4]="標題或簡介或其它HTML內容4";
function NextPic(){
    if(picNum<4) picNum++ ;//顯示4個圖片
    else picNum=1;
    if (document.all){
        //下面注意,如果存在於FORM表單中,需要使用下面的方法,否則可直接使用name。
        document.form1.imgInit.filters.revealTrans.Transition=Math.floor(Math.random()*23);
        document.form1.imgInit.filters.revealTrans.apply();
        document.form1.imgInit.filters.revealTrans.play();
    }
    document.images.imgInit.src=imgUrl[picNum];
    //如果不是圖片,而是SWF等,可做判斷,內容可在程式中做好,再放於下面。
    focustext.innerHTML='<a href='+imgLink[picNum]+' target=_blank>'+imgText[picNum]+'</a>';
    //設定翻頁時間
    theTimer=setTimeout('NextPic()', 3000);
}

function goUrl(){
    window.open(imgLink[picNum],'_blank');
}
</script>

HTML代碼中:
可以做到控制項中
<!--$圖片翻頁$-->
<TABLE cellPadding=0 width=100% border=0>
        <TR>
          <TD align=middle height="140" >
<div align='center'>
<a href='javascript:goUrl()'><img style="FILTER: revealTrans(duration=1,transition=5)" src="javascript:NextPic()" width="170" height="120" border="1"  id=imgInit name=imgInit></a></TD></TR>
 <TR><TD align=middle height="38" ><div name=focustext id=focustext align='center'></div>
</div>
</TD></TR></TABLE>
<!--$圖片翻頁$-->

該文章轉載自1024k:http://www.1024k.cn/develop/2007/200704/21252.html 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.