2017-05-24 37 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

回答