<script>
function check(){
var name=document.getElementById("name").value;
var pass=document.getElementById("pass").value;
if(name=="账号" && pass=="密码"){
alert("登入成功");
window.document.f.action="shujubiao/";
window.document.f.submit();
}else{
alert("用户名或密码错误");
}
}
</script>

下面的脚本我想实现连续输入3次账号密码错误自动跳转到禁止登陆页面怎么实现
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- xpxpxpx 2016-04-11 07:06关注
var errCount = 0; function check() { if (errCount < 3) { var name = document.getElementById("name").value; var pass = document.getElementById("pass").value; if (name == "账号" && pass == "密码") { errCount = 0; alert("登入成功"); window.document.f.action = "shujubiao/"; window.document.f.submit(); } else { errCount++; alert("用户名或密码连续错误次数" + errCount); } } if (errCount == 3) {// 连续输入3次账号密码错误 location.href = "登陆页地址.."; } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 3无用