zoukankan      html  css  js  c++  java
  • Ajax 密码验证


    var names = $("names");
    var pwds = $("pwds");
    var ts1 = $("ts1");
    var ts2 = $("ts2");
    var ts3 = $("ts3");
    function subtton(){
        if(names.value ==null||names.value.length==0){
            ts1.innerHTML ="请输入账号";
            names.focus;
            return false;
        }else if(pwds.value== null||pwds.value.length== 0){
            ts2.innerHTML ="请输入密码";
            pwds.focus;
            return false;
        }else{
            var r = chekYZ();
            return r;
        }
    }

    var xmlHttp;
    function chekYZ(){

        function getXmlHttp(){
            if(window.ActiveXObject){
                xmlHttp = new ActiveXObject("MICROSOFT.XMLHTTP");
            }else if(window.XMLHttpRequest){
                xmlHttp = new XMLHttpRequest();
            }
        }

        var f = false;
        xmlHttp.open("GET","denglu.php?names="+names.value+"&pwds="+pwds.value,false);
        xmlHttp.onreadystatechange = function(){
            if(xmlHttp.readyState == 4){
                if(xmlHttp.status == 200){
                   var txt = xmlHttp.responseText;
                    if(txt == "1"){
                        window.location.href="../zhuce/zhuce.php";
                        f = true;
                    }else{
                        ts3.innerHTML ="账户或者密码错误!";
                        window.location.href="#";
                        f = false;
                    }
                }
         }
       }
      xmlHttp.send(null);
        return f;
    }

     
    function $(id){
        return document.getElementById(id)
    }

  • 相关阅读:
    wenbao与LCIS(最长公共上升子序列)
    wenbao与cf上升序列(最多改变一个变为连续严格上升序列)
    wenbao与随机
    wenbao与cf(849D)思维
    wenbao与蓝桥
    wenbao与合肥网络赛
    wenbao与HDU
    wenbao与hiho最短路还原
    wenbao与cf连续子序列最大和问题
    wenbao与cf四个人坐车的故事
  • 原文地址:https://www.cnblogs.com/ZH1132672711/p/3744091.html
Copyright © 2011-2022 走看看