<html lang="en"> <head> <meta charset="UTF-8"> <title>登录</title> <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="format-detection" content="telephone=no"> </head> <body> <div class="login" style="text-align: center; margin-top: 215px;"> <h1>Welcome</h1> <div class="text"> <i class="fa fa-user-o" aria-hidden="true"></i><!-- Font Awesome --> <input type="text" placeholder="Username" id="name" style="auto;height: auto; margin-top: 10px;"> </div> <div class="text"> <i class="fa fa-lock" aria-hidden="true"></i><!-- Font Awesome --> <input type="password" placeholder="Password" id="pass" style="auto;height: auto;margin-top: 10px;"> </div> <button onclick="login()" style="margin-top: 35px; 100px;;height: 30px;">登录</button> </div> <script type="text/javascript"> function login() { let username = document.getElementById("name").value; let password = document.getElementById("pass").value; let uName = Math.floor(Math.sqrt(2) / 2); let pCode = Math.ceil(Math.sqrt(2)); console.log(uName) console.log(pCode) if (username == uName.toString() && password == pCode.toString()) { //alert("登录成功"); window.location = "__index.html"; return false; } else { alert("账号或密码错误"); window.location = "index.html"; return false; } } </script> </body> </html>
|
|