HTML页面输入密码才能访问加密代码

本文阅读 1 分钟
首页 技术教程 正文
<script type="text/javascript">   
function password() {   
var testV = 1;   
var pass1 = prompt('请输入密码','');   
while (testV < 3) {   
if (!pass1)   
history.go(-1);   
if (pass1 == "123") {//初始密码123   
alert('密码正确');   
break;   
}   
testV+=1;   
var pass1 =   
prompt('密码错误!请重新输入:');   
}   
if (pass1!="password" & testV ==3)   
history.go(-1);   
return " ";   
}   
document.write(password());   
</script>  
<!--下面添加你要显示的内容或者代码-->
显示内容!
<script type="text/javascript">   
loopy()   
function loopy() {   
var sWord =""  
while (sWord != "123") {//设置密码
sWord = prompt("输入正确密码才能登陆!")   
}   
alert("欢迎访问")   
}   
</script> 
<!--下面添加你要显示的内容或者代码-->
内容!
<script type="text/javascript">   
loopy()   
function loopy() {   
var sWord =""  
while (sWord != "123") {//设置密码
sWord = prompt("输入正确密码才能登陆!")   
}   
alert("欢迎访问")   
}   
</script> 
<!--下面添加你要显示的内容或者代码-->
内容!

<script type="text/javascript">   
function password() {   
var testV = 1;   
var pass1 = prompt('请输入密码:','');   
while (testV < 3) {   
if (!pass1)    
history.go(-1);   
if (pass1 == "123") {//设置密码
alert('口令正确,进行跳转');   
window.location.href="http://www.miniidc.cc";//添加你要跳转的页面
break;   
}    
testV+=1;   
var pass1 =    
prompt('密码错误','');   
}   
if (pass1!="password" & testV ==3)    
history.go(-1);   
return " ";   
}    
document.write(password());   
</script>

范例:

<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<script type="text/javascript">   
function password() {   
var testV = 1;   
var pass1 = prompt('请输入密码:','');   
while (testV < 3) {   
if (!pass1)    
history.go(-1);   
if (pass1 == "123") {//设置密码
alert('口令正确,进行跳转');   
window.location.href="http://www.miniidc.cc";//添加你要跳转的页面
break;   
}    
testV+=1;   
var pass1 =    
prompt('密码错误','');   
}   
if (pass1!="password" & testV ==3)    
history.go(-1);   
return " ";   
}    
document.write(password());   
</script>
</head>

保存成:index.html或者mima.html 改一下默认文档

本文来自投稿,不代表本站立场,如若转载,请注明出处:http://www.cnmini.net/index.php/archives/216/
#Kimsufi#:€12.99/月/I5-2300/16G内存/2TB硬盘/不限流量/100Mbps/法国
« 上一篇 04-25
#UltraVPS#:€2.8/月/4GB内存/100GB空间/5TB流量/KVM/荷兰/德国
下一篇 » 04-25

发表评论

成为第一个评论的人