zoukankan      html  css  js  c++  java
  • 跳转到登陆页的时候验证码页面不刷新是怎么回事?

    原先验证码是这么写的:

    <div class="lib">
                <span class="lib_l">验证码:</span><span class="lib_r"><asp:TextBox ID="verifyCode_txt"
                    runat="server" Width="90px" CssClass="r_text r_text3" runat="server" MaxLength="4"></asp:TextBox><a
                        href="#"><img id="imgVerify" alt="看不清?点击更换" onclick="this.src=this.src+'?'" src="VerifyCode.aspx?"
                            style="vertical-align: bottom;  80px; height: 20px; border: 1px solid #ccc;" /></a></span></div>

    之后点击“重新登录”,
    Response.Write("<script>window.parent.location.href='LoginNew2.aspx'</script>");

    但之后我断点到VerifyCode.aspx.cs是没有访问到的,请问下这是怎么回事??

    论坛大牛给的解决方法:

    一般都是IE缓存引起的

    方案一:对页面进行不缓存处理
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
        }

    方案二:<img标签用js输出
                  <script type="text/javascript" language="JavaScript">
                       var numkey = Math.random();
                       numkey = Math.round(numkey*10000);
                       document.write("<img src="VerifyCode.aspx?k="+ numkey +"" onClick="this.src+=Math.random()" alt="图片看不清?点击重新得到验证码" style="cursor:pointer;" />");
                    </script>

    最有我用了第二种方法实现了,第一种方法依旧是失败的!!有待解决

    <div class="lib">
                <span class="lib_l">验证码:</span><span class="lib_r"><asp:TextBox ID="verifyCode_txt"
                    runat="server" Width="90px" CssClass="r_text r_text3" runat="server" MaxLength="4"></asp:TextBox><a
                        href="#">
    
                        <script type="text/javascript" language="JavaScript">
                        var numkey = Math.random();
                        numkey = Math.round(numkey*10000);
                        document.write("<img src="VerifyCode.aspx?k="+ numkey +"" onClick="this.src+=Math.random()" alt="图片看不清?点击重新得到验证码" style="vertical-align: bottom;  80px; height: 20px; border: 1px solid #ccc;cursor:pointer;" />");
                        </script>
    
                    </a></span>
            </div>
  • 相关阅读:
    "less is more",用"less”命令查看linux文本文件
    Linux命令"ls"进阶说明
    Linux文件权限说明
    Ubuntu14.04安装Ruby2.2方法
    Ubuntu查找软件命令
    Using If/Truth Statements with pandas
    Categorical Data
    DataFrame.loc的区间
    pandas学习(一)
    JDBC编程之事务处理
  • 原文地址:https://www.cnblogs.com/wenghaowen/p/3581933.html
Copyright © 2011-2022 走看看