Ajax brings the user experience is obvious to all, the smallest application, we try to achieve. Still use the Hotheart Ajaxrequest class, starting with Ajax in another article, ASP.
The implementation effect is as follows:
The other is not much to say, the old rules, look at the code:
reg.html
<title>AJAX用户名检测</title>
<script type="text/javascript" src="ajaxrequest.js"></script>
<script type="text/javascript" >
var ajax=new AJAXRequest();
function regCheck() {
var uname=document.getElementById("user_name");
ajax.get("proc_user.asp? action=regcheck&user_name="+uname.value,usercheck);
}
function usercheck(obj) {
document.getElementById("msg_user_name").innerHTML=unescape (obj.responseText);
}
</script>
<body>
用户名:<input type="text" name="user_name" id="user_name"/>
<button onclick="regCheck();">检测用户</button><label id="msg_user_name">注:数据库中只有admin和shaoyun两个用户</label>
</body>