高分求肋简单问题
请问各位高手,怎么样在ASP3下实现用户注册的检查(数据库中是否已经存在用户名,并且在当前页面上显示出相应的提示信息),不刷新页面
------解决方案--------------------Ajax
------解决方案--------------------AJAX运用之注册用户即时检查测试asp版
<div>
用户名: <input type= "text " onblur= "ShowMess(); " id= "theUserID "> <span id= "checkresult "> </span> <br>
密 码: <input type= "text " name= "jiangsu ">
</div>
<script language= "JavaScript ">
<!--
function createXMLHttps()
{
var ret = null;
try {
ret = new ActiveXObject( 'Msxml2.XMLHTTP ');
}
catch (e) {
try {
ret = new ActiveXObject( 'Microsoft.XMLHTTP ');
}
catch (ee) {
ret = null;
}
}
if (!ret && typeof XMLHttpRequest != 'undefined ')
ret = new XMLHttpRequest();
return ret;
}
//显示检测以后的结果
function ShowMess()
{
var xmlhttp = createXMLHttps();
var str_userID = document.getElementById( 'theUserID ').value;
var check_result = document.getElementById( 'checkresult ');
xmlhttp.open( "GET ", 'checkuserId.asp?userid= '+str_userID,false);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
check_result.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}
-->
</script>
<%
'checkuserId.asp文件内容:
if trim(request.queryString( "userid ")) = "abcd " then
response.write "the userid is exists "
else
response.write "the userid can use "
end if
%>