墨色风雨
$('.dlbtn').click(function(){ $userid=document.getElementById('txtUsername').value; $pwd=document.getElementById('txtPassword').value; userlogin($userid,$pwd);}); //用户登录function userlogin(userid,pwd){ url="login_sql.jsp?userid="+userid+"&pwd="+pwd; //alert(url); xmlHttp=GetXmlHttpObject() if (xmlHttp==null){ alert ("Browser does not support HTTP Request") return} xmlHttp.onreadystatechange=stateLogin xmlHttp.open("GET",url,true)xmlHttp.send(null) }function stateLogin(){ if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ //document.getElementById("Validform_msg").style.display='block'; if(xmlHttp.responseText==0){ alert("用户名不存在!"); return; }else if(xmlHttp.responseText==-1){ alert("密码错误!"); return; }else if(xmlHttp.responseText==-2){ alert("管理员帐号不允许从前台登录!"); return; }else{ alert('登录成功!'); history.go(0); } } }function GetXmlHttpObject(){ var xmlHttp=null; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e){ // Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp;}