添加密码访问验证

在正文头部添加以下代码

<script language = JavaScript> function password() {

    var testV = 1;

    var pass1 = prompt('提示文本','');

    var passwordforthisarticle = "密码";

    var inputtimemax = 19960319;

    while (testV < inputtimemax) {

    if (!pass1)

    history.go(-1);

    if (pass1 == passwordforthisarticle) {

    break;

    }

    testV+=1;

    var pass1 =

    prompt('Password error!');

    }

    if (pass1!= passwordforthisarticle & testV == inputtimemax)  

    history.go(-1);

    return " ";

    }

    document.write(password());

</script>