日期:2014-05-18 浏览次数:20878 次
protected void Page_Load(object sender, EventArgs e)
{
DataOperation dbo = new DataOperation();
int returnValue;
string username = Convert.ToString(Request.QueryString["value"]);
returnValue = dbo.ChkUserName(username);
if (returnValue > 0)
{
returnValue = 1;
}
else
{
returnValue = 0;
}
Response.Write(returnValue);
}
//检测目标是否存在数据库中
function chkIsExist(testValue,url)
{
var xmlhttp;
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
try{ xmlhttp=new XMLHttpRequest(); }
catch(e){}
}
}
xmlhttp.open("get",url+"?value="+escape(testValue));
xmlhttp.onreadystatechange=function ()
{
if(4==xmlhttp.readyState)
{
if(200==xmlhttp.status)
{
//根据responseText判断值是否存在
if(xmlhttp.responseText=="1")
{
return true;
}
else
{
return false;
}
}
}
}
xmlhttp.send(null);