1 Star 3 Fork 0

王乐/Happiness

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
loin.html 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
王乐 提交于 2018-10-30 18:55 . no commit message
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
span{
color: red;
}
</style>
</head>
<body>
<input type="text" name="" id="username" value="" />
<input type="password" name="" id="password" value="" />
<span id="spn">
</span>
<input type="button" name="" id="btn" value="登录" />
<ul class="list">
<!--<li>
<h2></h2>
<img src="" />
<p></p>
</li>-->
</ul>
<script src="cookie.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var btn = document.getElementById('btn');
var txt1 = document.getElementById('username');
var txt2 = document.getElementById('password');
var spn = document.getElementById('spn');
btn.onclick = function(){
setcookies('username',txt1.value,70);
setcookies('password',txt2.value,70);
var username = txt1.value;
var password = txt2.value;
var xkl1 = new XMLHttpRequest();
var url ='http://jx.xuzhixiang.top/ap/api/login.php?username=11&password=1212'
xkl1.open('get',url);
xkl1.send(null);
xkl1.onload = function(){
if(xkl1.status == 200){
console.log(xkl1.responseText);
var obj = JSON.parse(xkl1.responseText);
console.log(obj.msg);
spn.innerHTML = obj.msg;
if(spn.innerHTML == "登录成功")
{
location.href='details.html';
}else{
spn.style.display = 'inline-block';
spn.innerHTML = '请核对登录信息';
}
}
}
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/SimonaGo/Happiness.git
git@gitee.com:SimonaGo/Happiness.git
SimonaGo
Happiness
Happiness
master

搜索帮助