如何阅读用户的文字输入?

时间:2017-05-07 02:19:23

标签: javascript html

<div class="third">
    <p>This site requires a password.</p>
    <button onclick="password()">Enter password</button>
    <center><img src="http://i66.tinypic.com/e0frqo.png"></center> 
</div>
<script>
function password() {
    var password = readLine("Enter the password to continue");
    if(password == "testpwd"){
        alert("Status: |Authorized|  Your access has been granted. ------>Go to testwebsite.com/main.html<------     ||Have a nice day||");
    } else {
        alert("Status: Unauthorized Access. Access denied. Try again or leave");
    }
}
</script>

请帮我弄清楚解决方案。我是html的新手。请不要花哨的话我无法理解。非常感谢。

1 个答案:

答案 0 :(得分:0)

更改此

readLine("Enter the password to continue");

到此

prompt("Enter the password to continue", "password");
相关问题