<!DOCTYPE HTML PUBLIC "
<html>
<head>
<title> asp+ajax檢測用戶名是否在存</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!
function checkUserName(userName){
//建立跨浏覽器的XMLHttpRequest對象
var xmlhttp;
try{
xmlhttp= new ActiveXObject(
}catch(e){
try{
xmlhttp= new ActiveXObject(
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
//創建請求
xml("get"
xml(){
if(xml{
if(xml{
//根據responseText判斷用戶名是否存在
if(xml("對不起
else alert("恭喜!該用戶名未被注冊!");
}else{
alert("網絡失敗
}
}
}
xml(null);
}
//
</script>
</body>
</html>
From:http://tw.wingwit.com/Article/program/net/201311/14009.html