我就改了CONN.ASP和SQL语句怎么CS时不提示是否能注册。我用的是SQLserver请各位大虾再帮忙看看是那有问题
<script language="JavaScript">
<!--
function check_User() {
var xmlHttp = false;
try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e) {try {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e2) {xmlHttp = false;}}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {xmlHttp = new XMLHttpRequest();}
if (document.form1.User.value!="") {
var User = document.form1.User.value;
xmlHttp.open("GET","reg_detectname.asp?a=b&name="+escape(User),false);
xmlHttp.send(null);
document.getElementById('a1').innerHTML = xmlHttp.responseText;
document.form1.submit.disabled = false;
} else {
document.getElementById('a1').innerHTML = "<font color=red>名字不能为空</font>";
document.a1.submit.disabled = true;
return true;
}
}
//-->
</script>
<form name="form1" action="Reg_save.asp" method="POST">
<input name="User" type="text" onkeyup="check_User();" /> <span zy="a1"></span>
</form>
reg_detectname.asp
<!--#include file="../db_conn/dhconn.asp"-->
<%
if request("a")="b" then
User=request("name")
set rs=server.createobject("adodb.recordset")
rs.open "select * from zy where zy='"&User&"'",conn,1,1
if rs.bof and rs.eof then
response.write "<font color=green>可以注册 !</font>"
else
response.write "<font color=red>不可以注册 !</font>"
end if
rs.close
set rs=nothing
end if
%>
[此贴子已经被作者于2007-9-21 12:04:37编辑过]