用户注册界面
<title>ajax用户验证</title>
<head>
<script language="javascript">
var xmlHttp;
function S_xmlhttprequest(){
               xmlHttp=null;
               if (window.XMLHttpRequest){// code for IE7, Firefox, Opera, etc.
                 xmlHttp=new XMLHttpRequest();
                 }
                else if (window.ActiveXObject){// code for IE6, IE5
                 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                 }
             }
function check()
{

if(document.getElementById("name").value!="")
{
S_xmlhttprequest();
xmlHttp.open("get","date1.php?name="+name,true);
xmlHttp.onreadystatechange = byname;
xmlHttp.send(null);
}
else
{
document.getElementById("name1").innerHTML="用户名不能为空";
exit;
}
}
function byname()
{
if(xmlHttp.readyState ==1)
{
              document.getElementById("name1").innerHTML = "检测中......";
}
if(xmlHttp.readyState ==4)
{
if(xmlHttp.status == 200)
{
    var name = xmlHttp.responseText;
document.getElementById("name").innerHTML =name;

}
}
}function pwd()
{
if(document.getElementById("pwd2").value=="")
{
document.getElementById("pwd1").innerHTML="密码不能为空";
exit;
}
else
{
document.getElementById("pwd1").innerHTML="该密码强度.....";
}
}
</script>
</head>
<body>
<form action="" method="post" name="myform">
<table align="center">
<tr><td>用户名:</td><td><input type="text" name="name" id="name" value="" onblur="check()"/>
</td><td><div id="name1"><font color="#CC66CC">*用户名必填*</font></div></td></tr>
<tr><td>密码:</td><td><input type="text" name="pwd2" id="pwd2" value="" onblur="pwd()"/>
</td><td><div id="pwd1"><font color="#CC66CC">*密码必填*</font></div></td></tr>
</table>
</form>
</body>
数据库验证代码
  <?php
sleep(1);
$connt = mysql_connect("localhost","root","root");
mysql_select_db('people',$connt );
mysql_query("set names 'gb2312'");
if($_GET['name'])
{
$name = $_GET['name'];
$sql = "select * from tb_user where usernc='$name'";
$restul = mysql_query($sql);
$array = mysql_fetch_row($restul);
// print_r($array);
if(is_array($array))
{
echo "<font color='red'>该用户名已经存在</font>";
}
else
{
echo "<font color='red'>该用户名可以用</font>";
}
}
if($_GET['pwd'])
{
$pwd = $_GET['pwd'];
$sql = "select * from tb_user where email='$pwd'";
$restul = mysql_query($sql);
$array = mysql_fetch_row($restul);
// print_r($array);
if(is_array($array))
{
echo "<font color='red'>该密码已存在</font>";
}
else
{
echo "<font color='red'>该密码可以用</font>";
}
}?>
就是想实现当鼠标离开文本域或者密码域时就去检测数据库是否有重名并且返回其后面,帮我看看要改那个地方