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

2019-07-31 0 893

最近做一个功能页面,想实现输入密码后才能加载制定页面,找到三段比较不错的输入密码才能访问代码,分享给大家。
代码一:HTML顶部或head之间:

<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>  
<!--下面添加你要显示的内容或者代码-->
这里是显示内容!

 

代码二:HTML顶部或head之间:

script type="text/javascript">   loopy()   function loopy() {   var sWord =""  while (sWord != "123") {//设置密码sWord = prompt("输入正确密码才能登陆!")   }   alert("欢迎访问")   }   </script> <!--下面添加你要显示的内容或者代码-->这里是显示内容!

代码三:HTML顶部或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="https://www.kxdao.net" rel="external nofollow" ;//添加你要跳转的页面break;   }    testV+=1;   var pass1 =    prompt('密码错误','');   }   if (pass1!="password" & testV ==3)    history.go(-1);   return " ";   }    document.write(password());   </script>

 

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

抓虾网 经验教程 HTML页面输入密码才能访问的代码 https://www.zhuax.com/1207.html

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务