AJAX(异步通信)的使用
<script type="text/javascript">//脚本语言标签
window.onload=function(){//网页加载完毕后开始执行
var um=document.getEllementById('username')
username.onblur=function(){
var name=this.value;
var xhr;
if(window.XMLHttpRequest){
//非IE5,IE6
xhr=new XMLHttpRequest();
}else{
//ie5,ie6
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.open('post','demo.java',true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded","");
xhr.send('name='+name);
xhr.onreadystatechange=function(){
if(xhr.readyState==4 && xhr.status == 200 ){
if(this.responseText){
}
}
}
}
}
</scritp>