< script language = " javascript " > function createxmlhttprequest() ... { var xmlhttp=false; try ...{ xmlhttp=new ActiveXObject('Msxm12.XMLHTTP'); } catch(e) ...{ try ...{ xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) ...{ try ...{ xmlhttp=new XmlHttpRequest(); } catch(e) ...{ } } } return xmlhttp; } function view() ... { var str = document.getElementById( "name").value; checkuser(str);} function checkuser(checkstrs) ... { var xmlhttp=createxmlhttprequest(); //var checkstrs=document.getElementById('UserLogName'); xmlhttp.open('get','check.asp?groupnme='+escape(checkstrs)+''); xmlhttp.onreadystatechange=function() ...{ if(xmlhttp.readyState==4) ...{ if(xmlhttp.status==200) ...{ if(xmlhttp.responseText=="0") ...{ document.getElementById("nameErr").innerText='不能使用; document.getElementById("name").innerText=''; var elem=document.all.name.createTextRange() elem.move("sentence") elem.select() return false; }else{ document.getElementById("bianhaoErr").innerText='可以使用:'+xmlhttp.responseText; } } } } xmlhttp.send(null); } </Script>