2007年01月11日 星期四 下午 03:21 <% @ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <! 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" > < title > 无标题页 </ title > < script type ="text/javascript" > <!--//--><![CDATA[//><!--function ValidationFunctionName(source, arguments){ var infoBoard; infoBoard=document.getElementById("backMsg"); infoBoard.innerText='查询中'; var userName =document.getElementById("UserName"); var oBao = new ActiveXObject("Microsoft.XMLHTTP"); oBao.open("Get","Check.aspx?username=" + userName.value,false); oBao.send(); var strResult = oBao.responseText; //如果返回 1 就代表可以使用,否则不能通过验证 if (Number(strResult) == 1) arguments.IsValid = true; else arguments.IsValid = false; //infoBoard.innerText='提示2';}//--><!]]></script></head><body> <form id="form1" runat="server"> <div id="backMsg"></div><div> <asp:TextBox ID="UserName" runat="server"></asp:TextBox><asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="UserName" ClientValidationFunction="ValidationFunctionName" ErrorMessage="被注册的用户名"></asp:CustomValidator> <asp:Button ID="Button1" runat="server" Text="Button" /><br /></div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </form></body></html>