日期:2014-05-18  浏览次数:20518 次

谁能帮我解释下这段代码,带我入AJAX的门
<script   type= "text/javascript "   language= "javascript ">

        var   xmlhttp;
       
        function   username_changed()
        {

                try{
                        xmlhttp   =   new   ActiveXObject( "Microsoft.XMLHTTP ");
                }catch(e){
                        try{
                                xmlhttp   =   new   ActiveXObject( "Msxml2.XMLHTTP ");
                        }catch(e){
                        try{
                                xmlhttp   =   new   XMLHttpRequest();
                        }catch(e){
                                xmlhttp   =   null;
                        }
                      }
                }
               
                var   url= "signup-ajax.aspx?username= "+document.getElementById( "ctl00_ContentPlaceHolder1_TextBoxusername ").value;

                xmlhttp.onreadystatechange   =   getReady;
                xmlhttp.open( "GET ",url,true);
                xmlhttp.send(null);
        }

        function   getReady()
        {
                if(xmlhttp==null)
                        return;
                       
                if(xmlhttp.readyState   ==   4)
                {
                        if(xmlhttp.status   ==   200)
                        {
                                document.getElementById( 'hint_username ').innerHTML   =   xmlhttp.responseText;
                        }
                        xmlhttp   =   null;
    &