<form action="https://www.baidu.com" onsubmit="return fc()">
<input type="text" name="username" value="vvv" />
<input type="password" name="password" />
<button type="submit">登录</button>
</form>
<script>
function fc() {
var fs = true
var inp1 = document.querySelectorAll("input")[0];
var inp2 = document.querySelectorAll("input")[1];
var myInp1 = inp1.value;
var myInp2 = inp2.value;
if (myInp1 == "zs") {
if (myInp2 == "12345") {
alert("输入正确");
return fs;
}
else {
fs = false;
alert("密码错误");
return fs;
}
}
else {
fs = false;
alert("用户名错误");
return fs;
}
}
</script>
构建一个登陆页面实现验证跳转
猜你喜欢
转载自blog.csdn.net/weixin_43748935/article/details/85132622
今日推荐
周排行