首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

验证码不是不能更新,而是先要点击服务器控件刷新页面后才能更新(奇怪的不得不问高手)解决方法

2012-02-14 
验证码不是不能更新,而是先要点击服务器控件刷新页面后才能更新(奇怪的不得不问高手)如题,如果那样的话验

验证码不是不能更新,而是先要点击服务器控件刷新页面后才能更新(奇怪的不得不问高手)
如题,如果那样的话验证码的更新也没什么意思了,还不如按F5把代码贴在下面

<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "Login.aspx.cs "   Inherits= "admin_Login "   %>

<!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 ">
        <meta   http-equiv= "Content-Language "   content= "zh-cn "   />
        <title> 后台登录页面 </title>
        <link   href= "../Styleshop.css "   rel= "stylesheet "   type= "text/css "   />
<style   type= "text/css ">
.foot   {
background-image:   url( 'images/loginfoot.gif ');
}
.login   {
text-align:   right;
color:#008080;
height:   25px;
}
</style>
<script   language   = "javascript "   type   = "text/javascript "   >
          function   getnewcode(Id)
          {
              document.getElementById   (Id).src= "Images.aspx ";
          }
</script>
</head>

<body>
        <form   id= "form1 "   runat= "server ">
        <div>
       
        <table   style= "width:   100%;   height:   158px "   cellspacing= "0 "   cellpadding= "0 ">
<tr>
<td   style= "height:   119px ">
<table   style= "width:   100% "   cellspacing= "0 "   cellpadding= "0 "   >
<tr>
<td   colspan= "3 "   style= "height:   70px "> </td>
</tr>
<tr>
<td   colspan= "3 ">
<img   alt= " "   src= "images/login1.gif "   width= "582 "   height= "256 "   /> </td>
</tr>
<tr>
<td> &nbsp; </td>
<td   style= "height:   139px;   width:   582px "   class= "foot ">
<table   style= "width:   100% "   cellspacing= "0 "   cellpadding= "0 "   >
<tr>
<td   style= "height:   25px;   width:   195px "   class= "login ">
用户名: </td>
<td   style= "width:   200px ">
<asp:TextBox   runat= "server "   id= "TextName "   BorderColor= "Teal "   BorderWidth= "1px "   BorderStyle= "Solid "   Width= "130px ">
</asp:TextBox>
</td>
<td> &nbsp; </td>
</tr>
<tr>
<td   style= "height:   25px;   width:   195px "   class= "login ">


密&nbsp;   码: </td>
<td   style= "width:   200px ">
<asp:TextBox   runat= "server "   id= "TextPwd "   BorderColor= "Teal "   BorderWidth= "1px "   TextMode= "Password "   BorderStyle= "Solid "   Width= "130px ">
</asp:TextBox>
</td>
<td> &nbsp; </td>
</tr>
<tr>
<td   style= "height:   25px;   width:   195px "   class= "login ">
验证码: </td>
<td   style= "width:   200px ">
<asp:TextBox   runat= "server "   id= "TextVerifyCode "   BorderColor= "Teal "   BorderWidth= "1px "   BorderStyle= "Solid "   Width= "130px ">
</asp:TextBox>
</td>
<td   align= "left "   >
                        <img   id   = "imgverify "   alt   = "点击刷新验证码图片 "   src   =   "Images.aspx "   onclick   = "getnewcode( 'imgverify ') "/> </td>
</tr>
<tr>
<td   style= "width:   195px "> &nbsp; </td>
<td   style= "width:   200px ">
<asp:ImageButton   runat= "server "   id= "LoginBtn "   ImageUrl= "images/loginbtn.gif "   />
<asp:ImageButton   runat= "server "   id= "Clear "   ImageUrl= "images/loginclear.gif "   /> </td>
<td   align= "left "> 点击刷新验证码 </td>
</tr>
</table>
</td>
<td> &nbsp; </td>
</tr>
</table>
</td>
</tr>
</table>
       
        </div>
        </form>
</body>
</html>


[解决办法]
Images.aspx里面写
Response.Expires = -100
[解决办法]
function getnewcode(Id)
{
document.getElementById (Id).src= "Images.aspx?t= "+(new Date()).getTime();
}
[解决办法]
Up一下。
[解决办法]
document.getElementById (Id).src= "Images.aspx?t= "+(new Date()).getTime();

加个随机参数
[解决办法]
是代码问题

热点排行