码迷,mamicode.com
首页 > 其他好文 > 详细

Ajax 密码验证

时间:2014-05-22 15:02:17      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:c   ext   http   a   get   html   


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 密码验证

标签:c   ext   http   a   get   html   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!