动态切换图片

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestShowImg.aspx.cs" Inherits="Greatwall.Site.Skeleton.Services.TestShowImg" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <table cellSpacing="0" cellPadding="0" width="279" align="center" border="0">
 <tr>
  <td>
   <div align="center"><DIV id="right_myshow_display">
     <DIV id="my_show" style="MARGIN-TOP: 10px; FILTER: revealTrans(transition=72,'duration=0.1) blendTrans(duration=0.1); VISIBILITY: hidden; HEIGHT: 150px">
      <div align="center">
       <a id="myA" title="xxx" href="#" target="_blank"><img id="img_id" style="BORDER-LEFT-COLOR: #666666; BORDER-BOTTOM-COLOR: #666666; BORDER-TOP-COLOR: #666666; BORDER-RIGHT-COLOR: #666666"
         height="117" src="" width="986" border="1" name="img_id"></a></div>
     </DIV>
    </DIV>
    
   </div>

  </td>
 </tr>
 <tr>
  <td valign=top>
   <div align="center" id="divTitle"></div>
  </td>
 </tr>
</table>

   
    </div>
    </form>
</body>
</html>
<SCRIPT language=javascript>
/*****************************************
功能: 实现图片定时的切换功能
******************************************/
var arrImage=new Array(),num;
var arrUrl = new Array();
var arrTitle = new Array();
num=0;
function show_pic(divid,num)
{
 divid.filters.revealTrans.apply();
 divid.style.visibility = "";
 divid.filters.revealTrans.transition = divid.filters.revealTrans.transition+num;
 divid.filters.revealTrans.play();
}
//解发器 
for(var i=0;i<3;i++)
{
    arrImage[i] = new Image();
 arrImage[i].src = i+".jpg";
 arrUrl[i] = "1";
 arrTitle[i] = "xxxxxx";
}
function dispTimer()
{
    if( num >=3 ) num = 0;
 show_pic(my_show,num);
 document.all.img_id.src =arrImage[num].src;
 document.all("myA").href = arrUrl[num];
 document.all("myA").title = arrTitle[num];
 document.all("myA").alt = arrTitle[num];
 if(arrTitle[num].length <=23)
 {
  document.all("divTitle").innerHTML = "<br>"+arrTitle[num];
 }
 else
 {
  document.all("divTitle").innerHTML = arrTitle[num];
 }
 num=num+1;
 window.setTimeout("dispTimer()",3000);
}
dispTimer(3000); //执行显示
</SCRIPT>

原文地址:https://www.cnblogs.com/sportdog/p/2741387.html