源码论坛

 找回密码
 立即注册
香港免备空间主机促销中心特价微空间价格表香港标准空间价格表高防攻击空间价格表金牌高防空间价格表

插入网页加密码访问页面源代码

[复制链接]
发表于 2024-7-21 18:53:05 | 显示全部楼层 |阅读模式
<script language="JavaScript">
    function password() {
      var testV = 1;
      var pass1 = prompt('Input password:', '');

      while (testV < 3) {
        if (pass1 === null) {
          alert('Cancel login');
          window.close(); // Close the window
          return;
        }

        if (pass1 === "host") {
          alert('Password is correct!');
          return;
        }

        testV++;
        pass1 = prompt('Password incorrect! Please re-enter:');
      }

      if (testV === 3) {
        alert('Three input errors!');
        window.close(); // Close the window
      }
    }
    password();



  </script>


 楼主| 发表于 2024-7-21 18:54:38 | 显示全部楼层
<SCRIPT language=JavaScript>
function password() {
var testV = 1;
var pass1 = prompt('请输入密码:','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "host") {
alert('密码正确!');
break;
}
testV+=-1;
var pass1 = prompt('你好密码错误!请重新输入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</SCRIPT>

未输对密码无关取消只能关闭网页
 楼主| 发表于 2024-7-21 19:02:05 | 显示全部楼层
<script language="JavaScript">
    function password() {
      var testV = 1;
      var pass1 = prompt('请输入密码:', '');

      while (testV < 3) {
        if (pass1 === null) {
          alert('取消登录');
          window.close(); // Close the window
          return;
        }

        if (pass1 === "host") {
          alert('密码正确!');
          return;
        }

        testV++;
        pass1 = prompt('密码错误! 请重新输入:');
      }

      if (testV === 3) {
        alert('三次输入错误!');
        window.close(); // Close the window
      }
    }
    password();
  </script>

中文版
 楼主| 发表于 2024-8-7 07:03:15 | 显示全部楼层

<script language="JavaScript">
    function password() {
      var testV = 1;
      var pass1 = prompt('再次请输入密码:', '');

      while (testV < 3) {
        if (pass1 === null) {
          alert('取消登录');
          window.close(); // Close the window
          return;
        }

        if (pass1 === "host") {
          alert('密码正确!');
          return;
        }

        testV++;
        pass1 = prompt('密码错误! 请重新输入:');
      }

      if (testV === 3) {
        alert('三次输入错误!');
        window.close(); // Close the window
      }
    }
    password();
  </script>
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

ymhost

QQ|论坛首页|空间首页|手机版|源码论坛

全屏模式

GMT+8, 2024-9-20 00:29

Powered by cy0575.cn X3.5

快速回复 返回顶部 返回列表