一:界面
二:代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Demo1.Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
function change() {
var sid = document.getElementById("img1");
sid.src = sid.src + '?';
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>验证码:</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<img alt="" src="ValidateCode.ashx" id="img1" onclick="src='ValidateCode.ashx?d='+new Date()" style="width:80px;height:30px"/>
<a href="#" onclick="change()">看不清,换一张</a>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
三:结果
点击看不清,换一张
注意:需要引用的第三方控件为:
ValidateCode.ashx.cs
ValidateCode.ashx
(如果需要控件的话,可以给我留言!(*^__^*) )