2015-07-13 64 views
-1

我已經下載了一個樣本形式是這樣的:爲什麼提交表單上的按鈕不工作?

<form id="login-user" method="post" accept-charset="utf-8" action="/home.html" class="simform"> 
    <div class="sminputs"> 
     <div class="input full"> 
     <label class="string optional" for="user-name">Email*</label> 
     <input class="string optional" maxlength="255" id="user-email" placeholder="Email" type="email" size="50" /> 
     </div> 
    </div> 
    <div class="sminputs"> 
     <div class="input full"> 
     <label class="string optional" for="user-pw">Password *</label> 
     <input class="string optional" maxlength="255" id="user-pw" placeholder="Password" type="password" size="50" /> 
           <span class="hide-password">Show</span> 
     </div> 
    </div> 

    <div class="simform__actions"> 
     <input class="sumbit" name="commit" type="sumbit" value = "Log in"/> 
     <span class="simform__actions-sidetext"><a class="special" role="link" href="#">Forgot your password?<br>Click here</a></span> 
    </div> 
    </form> 

當我按下提交按鈕它不工作,它會點擊文本越位按鈕!但是,當我改變這一行

<input class="sumbit" name="commit" type="sumbit" value = "Log in"/> 

<button class="sumbit" name="commit" type="sumbit" value = "Log in"/> 

這是工作,但我的CSS設計將改變。

我的另一個問題是,我想知道如果CSS文件可以對HTML頁面的功能有影響。我認爲這隻會影響設計和外觀。它是否影響上面的功能?

編輯

這裏是我的javascript

$("#login-user").submit(function(event){ 
     event.preventDefault(); 
     alert("Here"); 
     var name = $("#user-email").val(); 
     var pass = $("#user-pw").val(); 

     Parse.User.logIn(name,pass,{ 
      success: function(user){ 
       checkLogin(); 
       alert("Thanks for login"); 
       window.location.href = "/home.html"; 
     }, error : function(user, error){ 
      console.log("Login Error : " + error.message); 

     } 
    }); 

回答

5

我認爲這是正確的。

<button class="sumbit" name="commit" type="submit" value = ""> 
    Log in 
</button> 

您的type="sumbit"是錯誤的。

+0

感謝。正確。愚蠢的錯誤。 – Bernard

+0

有時候我們都會犯愚蠢的錯誤,很高興幫助你。 =) –

0

我想,你應該改變如下。

<button class="sumbit" name="commit" type="sumbit" value = "Log in"/> 

<button class="sumbit" name="commit" type="sumbit">Log in</button> 

參考你http://www.w3schools.com/tags/tag_button.asp

+0

什麼是'type =「sumbit」'? – j08691