SOURCE

console 命令行工具 X clear

                    
>
console
function login(){
    var username=document.getElementById('username');
    var pass=document.getElementById("password");
    if(username.value ==""){
        alert("请输入用户名");
    }else if (pass.value ==  ""){
       alert("请输入密码");
    }else if (username.value == "admin" && pass.value=="123456"){
      window.location.href="welcome.html";    
        }else{
            alert("请输入正确的账号和密码!");
        }   
}
//username.value == "admin" && pass.value=="123456"是固定的账号密码,
//window.location.href="welcome.html"  如果正确就跑到这个网页去
<div id="login-frame">
    <img src="	https://s1.hdslb.com/bfs/static/passport/static/img/rl_top.35edfde.png" alt="图片不见了">
    <p>账号:<input type="name" id="username"></p>
    <p>密码:<input type="password" id="password"></p>
    <div id="login-control">
        <input type="button" id="but-login" value="登入" onclick="login();"/>
        <a href="forget-pwd.html" id="forget-ped">忘记密码</a>
    </div>
</div>
#login-frame{
    width: 400px;
    height: 230px;
    background-color:	#E0FFFF;
}
img{
    width: 400px;
}
p{
    margin-top: 30px;
    display: flex;
    justify-content: center;
}
#login-control{
    margin-top: 30px;
    margin-bottom: 50px;
    display: flex;
    justify-content: space-between;
}
#but-login{
    margin-left: 50px;
}
#forget-ped{
    margin-right: 30px;

}