AJAX+.NET实现不用点击自动无刷新检测用户名是否存在
例如,会员注册的时候
用户名,密码,姓名,年龄等
在用户名中输入完成以后,不点提交,自动检测用户名是否已被占用了
这个例子有没有谁做过,哪位大哥提供个例子给我看看噻
------解决方案--------------------看看这个就知道怎么做了
http://www-128.ibm.com/developerworks/cn/xml/wa-ajaxintro1.html
------解决方案--------------------利用ajax轻松实现
------解决方案--------------------http://community.csdn.net/Expert/topic/5398/5398666.xml?temp=.8074304
------解决方案--------------------javascript鼠标离开输入框后提交ajax去返回结果啊
------解决方案--------------------什么是ajax?当你明白它的意思后一小段代码,使用xmlhttp对象,获取服务器段一个段XML文件就解决问题。
------解决方案--------------------http://blog.csdn.net/zhulei2008
------解决方案--------------------1.首先在web.config中配置好
<httpHandlers>
<add verb= "POST,GET " path= "ajax/*.ashx " type= "Ajax.PageHandlerFactory, Ajax " />
</httpHandlers>
2.
private void Page_Load(object sender, System.EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(clsValdate) ,this);
}
3.
internal class clsValdate
{
[Ajax.AjaxMethod]
public string ValidateInput(string userName)
{
string su = "xxx ";
//可以在这里操作.
string retVal = "用户不存在,可以使用! ";
if(userName.Equals(su))
retVal = "用户名已存在,请选用其它用户名 ";
return retVal;
}
}
4.
<script language= "javascript " type= "text/javascript ">
function ValidateInputData()
{
var txt = document.all[ "txtUserName "];
if(txt.value == " ")
{
Show( "用户名不能为空 ");
return false;
}
var _value = clsValdate.ValidateInput(txt.value).value;
if(_value != null)
{
Show(_value);
}
return true;
}
function Show(message)
{
var objMessage = document.all[ "spMessage "];
objMessage.style.display = " ";
objMessage.innerText = message;
}
</script>
5.
<table width= "450 " align= "center " cellpadding= "2 ">
<tr>
<td colspan= "2 " height= "20px " align= "center "> <span id= "spMessage " style= "display:none; " class= "ms "> </span> </td>
</tr>
<tr>
<td align= "right "> 用户名 </td>
<td>
<asp:TextBox id= "txtUserName " onblur= "return ValidateInputData(); " runat= "server " CssClass= "tb "> </asp:TextBox> </td>
</tr>
<tr>
<td align= "right "> 密码 </td>
<td>
<asp:TextBox id= "TextBox2 " runat= "server " CssClass= "tb "> </asp:TextBox> </td>
</tr>
<tr>
<td align= "right "> 确认密码 </td>
<td>
<asp:TextBox id= "TextBox3 " runat= "server " CssClass= "tb "> </asp:TextBox> </td>