输入正确进入密码保护页
发表时间:2024-06-01 来源:明辉站整理相关软件相关文章人气:
[摘要]把如下代码加入<body>区域中: <SCRIPT LANGUAGE="JavaScript"> function password() var testV = 1; var pass1 = prompt('请输入密码(密码是welcome):...
把如下代码加入<body>区域中:
<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('请输入密码(密码是welcome):','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "welcome") {
alert('密码正确!');
break;
}
testV+=1;
var pass1 =
prompt('密码错误!请重新输入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</SCRIPT>