如题,如果那样的话验证码的更新也没什么意思了,还不如按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>

解决方案 »

  1.   

    Images.aspx里面写
    Response.Expires = -100
      

  2.   

    function getnewcode(Id)
         {
           document.getElementById (Id).src="Images.aspx?t="+(new Date()).getTime();
         }
      

  3.   

    document.getElementById (Id).src="Images.aspx?t="+(new Date()).getTime();加个随机参数
      

  4.   

    谢谢高人,net_lover(【孟子E章】) ,cwwhy() ,liujiayu10(www.xybxy.com)
    问题解决。两种答案都正确
    能不能说说其中的原因?