2017-05-24 36 views
0

我遇到了登錄表單的功能問題。我想讓任何用戶按回車來檢查表單,這是行不通的。它只是提交表單到url(url.com/?pswrd=password)而不是使用checkForm()函數。它完成的是HTML和JavaScript,並沒有什麼是在服務器端完成的。HTML/JS登錄表單發行

<form onsubmit="checkForm(this)"> 
     <input id="password" 
     type="password" 
     name="pswrd"/> 
     <input id="btn" type="button" onclick="checkForm(this.form)" value="Login" class="hvr-float-shadow"/> 
    </form> 
    </font> 
    <script> 
     function checkForm(form) { 
      if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else if(form.pswrd.value == "[censored]") { 
       window.location.replace('/indexproxy.php') 
      } 
      else { 
       alert("Incorrect access code, please try again."); 
      } 
}; 
    </script> 
<font face=arial color=white size=2> 
<p>All access codes are CaSe SeNsiTIVE</p> 
</body> 
</center> 
</html> 
+0

請讓我們知道什麼是不工作,以及我們如何能夠幫助您? – colecmc

回答