2013-08-16 32 views
0

jQuery的我希望我的表格上的onclick函數來發送我的.PHP形式

<script type="text/javascript"> 
    var conf = { 
     isVip:false, 
     isMem:false 
    }; 
    var sinaSSOConfig = { 
     entry : 'mail', // 
     loginType : 0, 
     setDomain : true, 
     pageCharset :'UTF-8', 
     timeoutEnable : true, 
     loginTimeout : 45000, 
     customInit : function() { 
      sinaSSOController.setLoginType(3); 
    }, 
     customLoginCallBack : function(status){ 
      conf.loginCallBack(status); 
     } 
    }; 

 

<form name="vip_login" method="post" action="la.php">      
href="#" class="loginBtn">submit</a> 
</form> 

我怎樣才能使這個按鈕提交上述形式?

<a href="#" onclick="return false;">loading</a> 
<a href="#" onclick="return false;"><span class="vip"></span>submit</a> 
+0

形式在哪裏?您只上傳了開始標記。你也有語法錯誤,例如'li>'和'visble' – Itay

+0

請讓你清楚。你想要什麼 ?? –

回答

3

添加ID到您的表單和你的按鈕(或鏈接),例如id="my_form" & id="my_btn",那麼你可以提交當鏈接被點擊這樣的形式:

<!-- Code should be placed anywhere after the form--> 
<script> 
document.getElementById("my_btn").onclick = function() { 
    document.getElementById("my_form").submit(); 
    return false; 
} 
</script> 
0

嘗試這,

$("#buttonId").click(function() { $("form#formID").submit(); });

相關問題