function Checkdomain () {
var domain = document.getElementById ("domain"). Value;
if (domain = = ") {
Alert ("Please fill in the domain name!") ");
document.getElementById ("domain"). focus ();
return false;
}
var info=domain.match (/^[a-z0-9]+$/);
if (!info) {
Alert ("Domain name must be composed of letters and numbers!") ");
document.getElementById ("domain"). focus ();
return false;
}else{
var xml=window.activexobject? New ActiveXObject ("Microsoft.XMLHTTP"): New XMLHttpRequest ();
Xml.open (' Get ', '/index.asp?r=company/checkdomain&domain= ' +domain,true);
Xml.send (");
Xml.onreadystatechange = function ()
{
if (xml.readystate = = 4 && xml.status = 200)
{
var result = Xml.responsetext;
document.getElementById ("Result"). innerHTML = result;
}
}
}
}
ASP code
<%
'-----------------------------------------------------------------
Dim username
Username=trim (Request.Form ("username")) ' receives AJAX-sent parameters
If Username= "" Then Response.End ()
'------------------------------------------------------------------
Set Rs=server.createobject ("Adodb.recordset")
Sql= "SELECT * FROM test where username = '" &username& ""
Rs.Open sql,conn,1,1
'------------------------------------------------------------------
'--------if not found, return 0
'--------if found, return all matching items
If not (rs.eof and RS.BOF) then
Response.Write ("" &rs ("Time") & "")
Rs.close
Set rs=nothing
%>