日期:2014-05-16  浏览次数:20779 次

jsp+Ajax判断邮箱、用户名是否存在的问题(急) - Web 开发 / Ajax
HTML code
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<script type="text/javascript" language="javascript">
var xmlHttp=false;
var ShowObj="";
function AjaxCheck(url,httpMethod,Show_Obj)
{
    ShowObj=Show_Obj;
    
    if(!httpMethod)
    {
        httpMethod="POST";
    }
    xmlHttp=CreateXmlRequest();
    xmlHttp.onreadystatechange=StateContent;
    xmlHttp.open(httpMethod,url,true);
    xmlHttp.send(null);
}
function StateContent()
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            MakeOperate();
        }
    }
}
function MakeOperate()
{
    ShowObj.className = "Erro_Css";    
    //ShowObj.innerHTML = xmlHttp.responsetext;
    ShowObj.innerHTML = xmlHttp.responseText;
}
</script>
<script type="text/javascript" language="javascript">
function CreateXmlRequest( )
{    
    var xmlhttp_request = false;
     
    try
    {        
        if( window.ActiveXObject )
        {            
            for( var i = 5; i; i-- )
            {               
                try
                {                   
                    if( i == 2 )
                    {
                        xmlhttp_request = new ActiveXObject("Microsoft.XMLHTTP");                       
                    }
                    else
                    {
                        xmlhttp_request = new ActiveXObject("Msxml2.XMLHTTP." + i + ".0");    
                        xmlhttp_request.setRequestHeader("Content-Type","text/xml");
                        xmlhttp_request.setRequestHeader("Content-Type","UTF-8");               
                    }                    
                    break;
                }               
                catch(e)
                {   
                    xmlhttp_request = false;              
                }
            }       
        }
        else if(window.XMLHttpRequest)
        {            
            xmlhttp_request = new XMLHttpRequest();           
            
            if (xmlhttp_request.overrideMimeType) 
            {                
                xmlhttp_request.overrideMimeType('text/xml');            
            }       
        }   
    }
    catch(e)
    {        
        xmlhttp_request = false;   
    } 
    
    return xmlhttp_request ;
}

</script>
<script language="javascript">
function checkspace(checkstr)
{
    var str = '';
    
    for(i = 0; i < checkstr.length; i++)
    {
        str = str + ' ';
    }
    
    return (str == checkstr);
}

function getObj(objName)
{
    return(document.getElementById(objName));
}

function Check_OK(Erro_ID)
{
    var StrErro;
    var Obj;
    
    Obj=getObj(Erro_ID);
    StrErro = "<table width='300' bgcolor=E2F5FF><tr><td align=left valign=middle class=tdborder>&nbsp;&nbsp;<font color=red><B>ok!</B></font></td></tr></table>";
    Obj.innerHTML = StrErro;
}

function Check_AssetOK(Erro_ID)
{
    var StrErro;
    var Obj;
    
    Obj=getObj(Erro_ID);
    StrErro = "<FONT COLOR=RED font-size:14px>资料载入中,请稍后...</FONT>";
    Obj.innerHTML = StrErro;
}

function Show_Erro(Obj,Erro_Info)
{
     Obj.innerHTML = Erro_Info;
}

function Check_Onfocus(Erro_ID,Words)
{
    var Obj;    
    Obj=getObj(Erro_ID);    
    Obj.innerHTML = Words;
}
//Email验证
function Check_internetadd(Input_Value,Erro_ID)
{
    var StrErro;
    var Obj=getObj(Erro_ID);

    if (Input_Value.length==0||checkspace(Input_Value))
    {
         StrErro = '<table width =300  bgcolor="#FFE2E9"><tr><td class=tdborder4 ><font color=red