index.asp
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
< script language =javascript >
var xmlHttp = false ;
function createXMLHttpRequest()
{
xmlHttp = false ;
try
{
xmlHttp = new XMLHttpRequest();
}
catch (trymicrosoft)
{
try
{
xmlHttp = new ActiveXObject( " Msxml2.XMLHTTP " );
}
catch (othermicrosoft)
{
try
{
xmlHttp = new ActiveXObject( " Microsoft.XMLHTTP " );
}
catch (failed)
{
return false ;
}
}
}
if ( ! xmlHttp)
{
return false ;
}
}
//
function CheckUserNameInput()
{
var un = document.getElementById( ' username ' ).value
var dispObj = document.getElementById( " CheckResult " );
createXMLHttpRequest();
dispObj.innerHTML = ' 正在查询,请稍候... ' ; // 如果查询时间会很长,加上这一句比较好
xmlHttp.open( " get " , " CheckUserName.asp?keyword= " + escape(un) + "" , true );
// 访问checkusername.asp并给该页面传递一个参数
// 第一个参数可以使用post和get,是form的两种提交方式
xmlHttp.onreadystatechange = function ()
{
if ( 4 == xmlHttp.readyState)
{
if ( 200 == xmlHttp.status)
{
dispObj.innerHTML = xmlHttp.responseText;
}
}
}
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
< script language =javascript >
var xmlHttp = false ;
function createXMLHttpRequest()
{
xmlHttp = false ;
try
{
xmlHttp = new XMLHttpRequest();
}
catch (trymicrosoft)
{
try
{
xmlHttp = new ActiveXObject( " Msxml2.XMLHTTP " );
}
catch (othermicrosoft)
{
try
{
xmlHttp = new ActiveXObject( " Microsoft.XMLHTTP " );
}
catch (failed)
{
return false ;
}
}
}
if ( ! xmlHttp)
{
return false ;
}
}
//
function CheckUserNameInput()
{
var un = document.getElementById( ' username ' ).value
var dispObj = document.getElementById( " CheckResult " );
createXMLHttpRequest();
dispObj.innerHTML = ' 正在查询,请稍候... ' ; // 如果查询时间会很长,加上这一句比较好
xmlHttp.open( " get " , " CheckUserName.asp?keyword= " + escape(un) + "" , true );
// 访问checkusername.asp并给该页面传递一个参数
// 第一个参数可以使用post和get,是form的两种提交方式
xmlHttp.onreadystatechange = function ()
{
if ( 4 == xmlHttp.readyState)
{
if ( 200 == xmlHttp.status)
{
dispObj.innerHTML = xmlHttp.responseText;
}
}
}
xmlHttp.send();
}
</ script >
</ HEAD >
< BODY >
< form name ="form1" method ="get" >
< input name ="username" type =text >
< input type ="button" value ="Check" onclick ="CheckUserNameInput()" >
< font color =red style ="font-size=9pt" id ="CheckResult" ></ font >
</ form >
</ BODY >
</ HTML >
}
</ script >
</ HEAD >
< BODY >
< form name ="form1" method ="get" >
< input name ="username" type =text >
< input type ="button" value ="Check" onclick ="CheckUserNameInput()" >
< font color =red style ="font-size=9pt" id ="CheckResult" ></ font >
</ form >
</ BODY >
</ HTML >
CheckUserName.asp
<%
keyword = request.querystring( " keyword " )
response.write keyword
' 本例仅用来显示用户输入的内容,如果要作验证代码请自己加。
%>
keyword = request.querystring( " keyword " )
response.write keyword
' 本例仅用来显示用户输入的内容,如果要作验证代码请自己加。
%>