首页 > 其他 > 详细

Ajax 密码验证

时间:2014-05-22 15:01:58      阅读:356      评论:0      收藏:0      [点我收藏+]


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)
}

Ajax 密码验证,布布扣,bubuko.com

Ajax 密码验证

原文:http://www.cnblogs.com/ZH1132672711/p/3744091.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!