<!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>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>js ajax使用者註冊驗證代碼</title>
<script>
///////ajax///////
function createobject(){
var xmlhttp;
try{
xmlhttp=new activexobject("microsoft.xmlhttp");
}
catch(e){
try{
xmlhttp=new xmlhttprequest();
}
catch(e){
xmlhttp=false;
}
}
return xmlhttp;
}
function getwebselect2(){
var xmlhttp=createobject();
if(xmlhttp){
var nameid=document.getelementbyid('user_name').value;
xmlhttp.open('get','regcs.asp教程?name='+nameid+"&n="+math.random(),true);
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readystate==4 && xmlhttp.status==200){
content=unescape(xmlhttp.responsetext);
//alert(content);
//weekday.innerhtml=content;
//return content;
document.getelementbyid('tidd').value=content;
if(content==1){
uname.innerhtml='<img src="images/icon_03.gif" width="17" height="17" border="0" align="absmiddle" hspace="2"/>該使用者名稱已被註冊!';
return false;
}
else{
uname.innerhtml='<img src="images/icon_01.gif" width="17" height="17" border="0" align="absmiddle" hspace="2"/>';
}
}
else{
//content.innerhtml='資料正在載入...';
}
return true;
}
xmlhttp.send(null);
}
}
function getwebselect3(){
var xmlhttp=createobject();
if(xmlhttp){
var user_code=document.getelementbyid('user_code').value;
xmlhttp.open('get','regcs.asp?code='+user_code+"&n="+math.random(),true);
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readystate==4 && xmlhttp.status==200){
content=unescape(xmlhttp.responsetext);
//alert(content);
//weekday.innerhtml=content;
//return content;
document.getelementbyid('tidd2').value=content;
if(content==1){
code2.innerhtml='<img src="images/icon_03.gif" width="17" height="17" border="0" align="absmiddle" hspace="2"/>驗證碼輸入錯誤!';
return false;
}
else{
code2.innerhtml='<img src="images/icon_01.gif" width="17" height="17" border="0" align="absmiddle" hspace="2"/>';
}
}
else{
//content.innerhtml='資料正在載入...';
}
return true;
}
xmlhttp.send(null);
}
}
</script>
</head>
<body>
<tr>
<td width="98" align="right" class="reg-item"><span class="color">*</span> 使用者名稱稱:</td>
<td width="261" valign="middle"><input name="user_name" type="text" class="input_out" id="user_name" onfocus="onfuos('user_name')" onblur="reg()" onmousemove="this.classname='input_move'" onmouseo教程ut="this.classname='input_out'" style="width:250px;" />
<label>
<input name="tidd" type="hidden" id="tidd" />
</label>
<label></label>
</td>
<td width="527" valign="middle"><span id="uname"></span></td>
</tr>
</body>
</html>