比如说: 有图片 1.jpg, 2.jpg, 3.jpg
  
   在一个DIV里  怎么样让他 轮换显示, 开始显示 1.jpg,过几秒后换成显示2.jpg, 再过几秒换成显示 3.jpg. 然后又过几秒显示1.jpg      是否是用 JS实现?    如果在FLASH里面 把3张图片做成FLASH的轮换 在粘进来?

解决方案 »

  1.   

    http://www.makewing.com/lanren/jscode/js-0021/
      

  2.   

    var oBtnPic = new BtnPic();
    oBtnPic.Initialize();//BtnPic类
    function BtnPic(){
    this.ContentName = "HotelPictureContent";   //控件容器名称
    this.PicSrc = new Array();                  //图片地址
    this.PicBtn = new Array();                  //图片显示控件
    this.PicName = new Array();                 //图片名称
    this.PicLabel = new Array();                //图片名称显示控件
    this.Btn = $("DefaultImage");               //大图显示控件
    this.Path = ""; this.Initialize = Initialize;           //初始化
    this.Load = Load;                       //加载数据
    this.Left = Left;                       //左移
    this.Right = Right;                     //右移  
    this.Select = Select;                   //选中
    this.Error = Error; //错误发生时

    this.BtnLeft = $("ImgGoLeft");
    this.BtnRight = $("ImgGoRight");
    this.ErrorImage = "/skin/default070524/442x349.jpg";
    }
    //返回对象引用
    function $(id){
    return document.getElementById(id);
    }//初始化数据,此应包含"大堂,外观,客厅"的图与图库里的图;
    function Initialize(){
        //图片数据初始化        1,小图,2,大图,3图片名称
        var rootNode = document.getElementById("XmlPhotos").XMLDocument.documentElement;
        if(rootNode == null) return;
        for( var i=0; i<rootNode.selectNodes( "//photo" ).length; i++ ){
    if(rootNode.selectNodes("//photo")[i].childNodes[4].text == 0){//默认显示,值0
    this.PicSrc.push(rootNode.selectNodes( "//photo" )[i].childNodes[1].text);//smallfilename
    this.PicName.push(rootNode.selectNodes( "//photo" )[i].childNodes[3].text);//photoname
            }
        }
        
        //控件初始化,显示图片
        var oControl = $(this.ContentName).getElementsByTagName("img");
        if(oControl == null || oControl == undefined) return;
        var oData = new Array();
        for(var p=0;p<oControl.length;p++){
            if(oControl[p].id.toLowerCase().indexOf("listimage") > -1){
                oData.push(oControl[p].id);
            }
        }
        this.PicBtn = oData;
        oData=null;
        oControl=null;
        
        //控件初始化,显示图片名称
        var iControl = $(this.ContentName).getElementsByTagName("span");
        if(iControl == null || iControl == undefined) return;
        var iData = new Array();
        for(var j=0;j<iControl.length;j++){
            if(iControl[j].id.toLowerCase().indexOf("listspan") > -1){
                iData.push(iControl[j].id);
            }
        }
        this.PicLabel = iData;
        iData=null;
        iControl=null;
        
        if(this.PicSrc.length<=3){
    this.BtnLeft.style.display = "none";
    this.BtnRight.style.display = "none";
        }else{
         this.BtnLeft.style.display = "block";
    this.BtnRight.style.display = "block";
        }
        
        if(this.PicSrc[0] == null || this.PicSrc[0] == undefined || this.PicSrc[0].indexOf("skin") != -1)
    this.Btn.src = this.ErrorImage;
        else
            this.Btn.src = this.Path + this.PicSrc[0].replace("/Thumb","");
        this.Load();
    }//加载图片
    function Load(){
    for(var i=0;i<this.PicBtn.length;i++){
    $(this.PicBtn[i]).src = this.Path + this.PicSrc[i];
    $(this.PicLabel[i]).innerText = this.PicName[i];
    }
    }//左移
    function Left(){
    this.PicSrc.push(this.PicSrc[0]);//将第一项添加到数组最后
    this.PicSrc.shift();//删除第一项
    this.PicName.push(this.PicName[0]);
    this.PicName.shift();
    this.Load();
    }//右移
    function Right(){
    this.PicSrc.unshift(this.PicSrc[this.PicSrc.length-1]);//将最后一项添加至开头
    this.PicSrc.pop();//删除最后一项
    this.PicName.unshift(this.PicName[this.PicName.length-1]);
    this.PicName.pop();
    this.Load();
    }//选中的图片
    function Select(oBtn){
    //处理小图与大图的路径
    if(oBtn.src.indexOf("skin") == -1){
    this.Btn.src = oBtn.src.replace("/Thumb","");//oPath + "/Thubm" + oName;
    }else{
    this.Error();
    }
    }//错误发生时
    function Error(){
    this.Btn.src = this.ErrorImage;//大图
    return;
    }
      

  3.   

    <div id="oTransContainer" style="filter: progid:DXImageTransform.Microsoft.Wipe(GradientSize=1.0, wipeStyle=0, motion='forward');width: 777px; height: 112px">
        
        <%
            DataTable dt = zbgg();//得到数据
            if (dt.Rows.Count == 0)
            {
        %>
        <a href="http://www.jinjian-gz.com/index.asp" target="_blank">
            <img id="oDIV1" align="absmiddle" border="0" height="80"  src="/person/uppic/ggpic/588.gif" width="777" /></a>
        <%
        }
        else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Response.Write("<A href='" + dt.Rows[i]["SiteUrl"] + "' target=_blank><IMG width='777' height='112' border='0' src='/person/uppic/ggpic/" + dt.Rows[i]["ImagesUrl"].ToString() + "'  align='absmiddle' id='oDIV"  + dt.Rows[i]["SortNo"].ToString() +"' style='display: none'> </A>");
                                }
            }
        %>
        </div>
        <%
            string ggcount = dt.Rows.Count + ";";
            //Response.Write(ggcount);
            Response.Write("<script>");
    Response.Write("var NowFrame = 1;");
    Response.Write("var MaxFrame =" + ggcount);
    Response.Write("var bStart = 0;");
    Response.Write("function fnToggle() {");
    Response.Write("var next = NowFrame + 1;");
    Response.Write("if(next == MaxFrame+1) ");
    Response.Write("{");
    Response.Write(" NowFrame = MaxFrame;");
    Response.Write(" next = 1;");
    Response.Write("}");
    Response.Write("if(bStart == 0)");
    Response.Write("{");
    Response.Write(" bStart = 1;");
    Response.Write(" setTimeout('fnToggle()', 3000);");
    Response.Write(" return;");
    Response.Write("}");
    Response.Write("else");
    Response.Write("{");
      Response.Write("  oTransContainer.filters[0].Apply();");
    Response.Write(" document.images['oDIV'+next].style.display = '';");
    Response.Write(" document.images['oDIV'+NowFrame].style.display = 'none'; ");
    Response.Write(" oTransContainer.filters[0].Play(duration=2);");
    Response.Write(" if(NowFrame == MaxFrame) ");
    Response.Write(" NowFrame = 1;");
    Response.Write(" else");
    Response.Write(" NowFrame++;");
    Response.Write("} setTimeout('fnToggle()', 3000);");
    Response.Write("}");Response.Write("fnToggle();");
    Response.Write("</script>");         %>
      

  4.   

    演示地址
    http://www.momo35.com
      

  5.   

    JS的可以
    也可以做成FLASH,如果图片有联接可以在FLASH里面做连接都能实现的!
      

  6.   

    http://topic.csdn.net/u/20080303/13/1692212d-fc95-4cfa-9c8f-7b9a0f39140e.html?seed=1849133462
    这里有篇文章。你可以参考
      

  7.   

    很简单,有现成控件:
    <asp:adrotator AdvertisementFile="ads.xml" BorderColor="black" BorderWidth=1 runat="server"/>in ads.xml:<Advertisements>   <Ad>
          <ImageUrl>/quickstart/aspplus/images/banner1.gif</ImageUrl>
          <NavigateUrl>http://www.microsoft.com</NavigateUrl>
          <AlternateText>Alt Text</AlternateText>
          <Keyword>Computers</Keyword>
          <Impressions>80</Impressions>
       </Ad>   <Ad>
          <ImageUrl>/quickstart/aspplus/images/banner2.gif</ImageUrl>
          <NavigateUrl>http://www.microsoft.com</NavigateUrl>
          <AlternateText>Alt Text</AlternateText>
          <Keyword>Computers</Keyword>
          <Impressions>80</Impressions>
       </Ad>   <Ad>
          <ImageUrl>/quickstart/aspplus/images/banner3.gif</ImageUrl>
          <NavigateUrl>http://www.microsoft.com</NavigateUrl>
          <AlternateText>Alt Text</AlternateText>
          <Keyword>Computers</Keyword>
          <Impressions>80</Impressions>
       </Ad></Advertisements>