验证码 更换的问题
我写一个验证码 更换的问题
这样就没有办法更换
<img id= "Img1 " onclick= "this.src=this.src " alt= "看不清的话,点击更新 " style= "cursor:hand; " src= "/ValidateKey.aspx " width= "60 " height= "20 " border= "0 " />
下面这个点击后就可以更换
<img id= "ValidateKye " onclick= "this.src=this.src+ '1 ' " alt= "看不清的话,点击更新 " style= "cursor:hand; " src= "/ValidateKey.aspx?id=1 " width= "60 " height= "20 " border= "0 " />
是不是有一个缓存的问题,导致上面那个换不的呢.
请指教我下.....
------解决方案--------------------Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Response.Expires = 0;
Response.CacheControl = "no-cache ";
Response.AppendHeader( "Pragma ", "No-Cache ");
------解决方案-------------------- <asp:TextBox ID= "CheckCode " runat= "server " Width= "85px "> </asp:TextBox> <a href= "javascript:loadimage(); "> <asp:Image id= "Image1 " runat= "server " ImageUrl= "Validate.aspx "> </asp:Image> </a>
<script type= "text/javascript " language= "JavaScript ">
<!--
function loadimage(){
document.getElementById( "Image1 ").src = "Validate.aspx? "+Math.random();
}
//-->
</script>