页面使用密码保护代码
代码如下所示:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>密码保护相应页面</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('请输入密码(密码是shenlong):','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "shenlong") {
alert('密码正确!');
break;
}
testV+=1;
var pass1 =
prompt('密码错误!请重新输入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</SCRIPT>
</body>
</html>
相关文章
JavaScript使用SpreadJS创建Excel查看器
在现代的Web应用开发中,Excel文件的处理和展示是一项常见的需求,小编今天将为大家展示如何借助SpreadJS来创建一个Excel查看器,感兴趣的小伙伴可以了解下2023-12-12
IE,firefox(火狐)浏览器无提示关闭窗口js实现代码小结
在不是js打开的页面上按window.close(),会有提示框,很烦,现在可以不用了,没有提示框直接关闭窗口。下面脚本之家编辑特为大家整理了一些。2009-09-09


最新评论