2017-05-07 4 views
0
<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

'

readLine("Enter the password to continue"); 

? 이 광기는 무엇입니까? –

+0

나는 내가 너 n이라고 말했다. –

+0

코드에는 문제가 너무 많아서 다루지 않을 것이지만, 주된 문제는 'readLine'이 정의되어 있지 않다는 것이다. 사용자 입력을 쉽게 얻을 수있는 방법 (학습 목적)을 찾고 있다면'prompt'를 사용하십시오. –

답변

0

변경`2017에서이

prompt("Enter the password to continue", "password"); 
+0

변경 읽기 전용 ("계속하려면 암호 입력"); – bharath

관련 문제