页面使用密码保护代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

页面使用密码保护代码

  2020-05-13 我要评论

代码如下所示:

<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>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们