为什么下面那个又可以验证账号密码,上面那个又不可以
html吧
全部回复
仅看楼主
level 2
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>默认标题</title> <link rel="stylesheet" href="css/font-awesome.css"></head><body> <div style="height:100px"><i class="fa fa-user-o " style="font-size: 32px;"></i></div> <div class="bg"> <div class="main"> <p style="border-bottom:1px solid whitesmoke;"><i class="fa fa-user fa-1x"></i> 用户登录</p> <div class="user"> <input type="text" id="user" placeholder="账号"/> </div> <div class="pwd"> <input type="password" id="pwd" placeholder="密码"/> </div> <button type="button" id="checkedpass" onclick="passcheck()">登录</button> </div> </div></body></html>
<style> .main{ margin: auto; margin-top:60px; width:340px; height:300px; border: 1px solid gray; border-radius:4px; box-shadow: 0 0 6px white; position: absolute; right:100px; padding: 10px; background-color: white; }
.submit { width: 100%; }
.user,.pwd{ width:100%; height:30px; border: 1px solid #ebebeb; padding:0 0 0 30px; margin-top:10px; background-image: url("images/user.png"); background-repeat: no-repeat; background-size: 32px 32px; background-color: whitesmoke; }
*{box-sizing: border-box;} #user,#pwd{ width:100%; height:100%; border:none; border-left:1px solid #ebebeb; padding: 2px; } .pwd{ background-image: url("images/pwd.png"); }
button{ width:100%; height:40px; margin-top: 20px; border: 1px solid #09b1ff !important; background-color: #09b1ff !important; }
.bg{ position: relative; width:100%; height: 600px;
background-image: url("images/bg.png"); }</style><script> function passcheck() { var username=document.getElementById("user").Value; var userpass=document.getElementById("pwd").Value; if(username=="123" && userpass=="123"){ window.location.href="https://www.taobao.com"; return true; }else{ alert("密码或着账号错误!!!"); return false; }
}</script>
----------------------------------------------------------------------------------
<!doctype html><html lang="en"><head> <meta charset="UTF-8"> <title>example</title></head><body> 账号:<input type="text" id="input"> <br> 登录:<input type="password" id="pwd"> <button id="btn" onclick="begin()">click</button> <script> function begin(){ var aa=document.getElementById("input").value; var bb=document.getElementById("pwd").value; if(aa=="123"&&bb=="123"){ alert(aa); } else{ alert("错误"); } } </script></body>
2020年05月30日 19点05分 1
1