2015-9-1

 

var url = "<%=servletName%>?user="+username.value+"&pwd="+password.value;
  var xmlHttp = createXMLHttpRequest();                    
  xmlHttp.onreadystatechange = function() {        
  if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {                        
   var message = xmlHttp.responseText; //获取返回文本值                        
   if(isStrEq(message, "succeed")) {
   login.remember(username.value, password.value);
          window.location.href = "/scfz/default.jsp";
   } else {
    $("trTip").style.display = "block";
    $("tip").innerHTML = message;
    username.focus();
   }
  }
 };  
 xmlHttp.open("POST", url, true);
 xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
 xmlHttp.send(null);
       //生成XMLHTTPRequest
        function createXMLHttpRequest() {
 if(window.XMLHttpRequest) {
  return new XMLHttpRequest();
 } else if(window.ActiveXObject) {
  return new ActiveXObject("Microsoft.XMLHTTP");
 }
       }

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2022-01-17
  • 2021-12-22
  • 2022-02-19
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案