1 Star 0 Fork 1

yihoc/WEBWMS

forked from gujiejing/WEBWMS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
validation.js 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
wisdom 提交于 2017-11-03 23:31 . upupup new alll
window.onload = initPage;
function initPage(){
document.getElementById("logoin").onclick=loginUser;
getTime1();
}
//logoin
function getTime1(){
timeRequest = createRequest();
if(timeRequest==null){
alert("创建AJAX失败,请使用支持AJAX的游览器");
}else{
var url = "getTime.php";
timeRequest.open("GET",url,true);
timeRequest.onreadystatechange = callTimeBack;
timeRequest.send(null);
console.log("OK");
}
}
function callTimeBack(){
if(timeRequest.readyState == 4){
if(timeRequest.status == 200){
document.getElementById("setTimer").innerHTML=timeRequest.responseText;
setTimeout("getTime1()",1000);
}
}
}
function loginUser(){
var username = document.getElementById("username").value;
var passwd = document.getElementById("pwd1").value;
//alert("abc:"+username+passwd);
//alert(passwd);
if(passwd=="")
{
alert("密码不能为空");
}
loginRequest = createRequest();
if(loginRequest==null){
alert("创建AJAX失败,请使用支持AJAX的游览器");
}else{
var url = "loginCheck.php?user=" +
escape(username) + "&passwd=" +
escape(passwd);
//alert(url);
loginRequest.onreadystatechange = loginResult;
loginRequest.open("GET",url,true);
loginRequest.send(null);
}
}
//createRequest
//username
//pwd1
//loginCheck.php?user=gjj&passwd=123
function loginResult(){
if(loginRequest.readyState == 4){
if(loginRequest.status == 200){
//alert(loginRequest.responseText);
//console.log(loginRequest.responseText);
var result = loginRequest.responseText;
if(result==1){
console.log("OK");
window.location.href="mianz.html";
}else{
console.log("NO");
document.getElementById('result').innerHTML="密码错误";
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/yihoc/WEBWMS.git
git@gitee.com:yihoc/WEBWMS.git
yihoc
WEBWMS
WEBWMS
master

搜索帮助