<script language="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('Input password:', '');
while (testV < 3) {
if (pass1 === null) {
alert('Cancel login');
window.close(); // Close the window
return;
}
if (pass1 === "host") {
alert('Password is correct!');
return;
}
testV++;
pass1 = prompt('Password incorrect! Please re-enter:');
}
if (testV === 3) {
alert('Three input errors!');
window.close(); // Close the window
}
}
password();
</script>
|