輸入正確進(jìn)入密碼保護(hù)頁
發(fā)表時(shí)間:2024-06-01 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]把如下代碼加入<body>區(qū)域中: <SCRIPT LANGUAGE="JavaScript"> function password() var testV = 1; var pass1 = prompt('請(qǐng)輸入密碼(密碼是welcome):...
把如下代碼加入<body>區(qū)域中:
<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('請(qǐng)輸入密碼(密碼是welcome):','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "welcome") {
alert('密碼正確!');
break;
}
testV+=1;
var pass1 =
prompt('密碼錯(cuò)誤!請(qǐng)重新輸入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</SCRIPT>