页面使用密码保护代码
页面使用密码保护代码
发布时间:2016-12-30 来源:查字典编辑
摘要:代码如下所示:密码保护相应页面functionpassword(){vartestV=1;varpass1=prompt('请输入密码(密码...

代码如下所示:

<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教程学习
热门Javascript教程学习
编程开发子分类