zoukankan      html  css  js  c++  java
  • 图片替换

    html代码:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    <!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>
        <link type="text/css" rel="Stylesheet" href="css/StyleSheet.css" />
    
        <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
    
        <script type="text/javascript" language="javascript">
    $(document).ready(function(){
    
    //中图广告
    var zt_up="<%=ztStr %>";
    var zt_up_arr=new Array();
    zt_up_arr=zt_up.split(';');
    var zt_up_index=0;
    function UpdateZt_up()
    {
    
        $(".ztgg_container_up img").attr("src",zt_up_arr[zt_up_index]);
        $(".ztgg_container_down img").attr("src",zt_up_arr[zt_up_index+1]);
        if(zt_up_index==zt_up_arr.length-2)
        zt_up_index=0;
        else
        zt_up_index=zt_up_index+2;
    
    }
    UpdateZt_up();
    window.setInterval(UpdateZt_up,3000);
    
    //小图广告
    var xtgg="<%=xtStr %>";
    var xtgg_arr=new Array();
    xtgg_arr=xtgg.split(';');
    var xtgg_index=0;
    var child=$(".xtgg_container").find(".xtgg_container_item");
    function updateXt()
    {
    
    for(var i=0;i<child.length;i++)
    {
      $(child[i]).find("img").attr("src",xtgg_arr[xtgg_index]);
      xtgg_index++;
    }
     if(xtgg_index==xtgg_arr.length-5)
     xtgg_index=0;
    
    }
    
    updateXt();
    window.setInterval(updateXt,5000);
    
    });
    
    
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <div class="gg_container">
                <div class="dt_container">
                </div>
                <div class="ztgg_container">
                    <div class="ztgg_container_up">
                        <img /></div>
                    <div class="ztgg_container_down">
                        <img /></div>
                </div>
                <div class="login">
                </div>
                <div class="xtgg_container">
                    <div class="xtgg_container_item" style=" margin-left:0px;">
                    <img />
                    </div>
                    <div class="xtgg_container_item">
                       <img />
                    </div>
                    <div class="xtgg_container_item">
                       <img />
                    </div>
                    <div class="xtgg_container_item">
                       <img />
                    </div>
                    <div class="xtgg_container_item" style=" margin-right:0px;">
                       <img />
                    </div>
                </div>
            </div>
        </div>
        </form>
    </body>
    </html>

    cs代码:

        public string ztStr = "";
        public string xtStr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            ztStr = "img/g1.jpg;img/g2.jpg;img/g3.gif;img/g5.gif";
            xtStr = "img/g4.jpg;img/g4.jpg;img/g4.jpg;img/g4.jpg;img/g4.jpg;";
            xtStr +="img/g1.jpg;img/g1.jpg;img/g1.jpg;img/g1.jpg;img/g1.jpg;";
            xtStr += "img/g8.jpg;img/g8.jpg;img/g8.jpg;img/g8.jpg;img/g8.jpg";
        }
  • 相关阅读:
    WPF获取分辨率2
    怎样将UNIX Shell作为Concurrent Program来运行
    转 FRM40654 Record has been updated Requery block to see change
    各模组相关interface
    EBS 表后缀的含义
    Oracle Form開發Form消息提示
    EBS多组织(OU
    EBS 开发基础知识
    FORM:在不同窗口中传递参数
    AR 金额计算
  • 原文地址:https://www.cnblogs.com/engine/p/4256627.html
Copyright © 2011-2022 走看看