日期:2014-05-16 浏览次数:20784 次
$('regname').onblur = function(){ name = $('regname').value; alert(name); if(cname1 == 'yes'){ xmlhttp.open('get','chkname.php?name='+name,false); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4){ if(xmlhttp.status == 200){ var msg = xmlhttp.responseText; alert(msg); if(msg == '1'){ $('namediv').innerHTML="<font color=green>恭喜您,该用户名可以使用!</font>"; cname2 = 'yes'; }else if(msg == '2'){ $('namediv').innerHTML="<font color=red>用户名被占用!</font>"; cname2 = ''; }else{ $('namediv').innerHTML="<font color=red>"+msg+"</font>"; cname2 = ''; } } } chkreg(); } xmlhttp.send(null); } }