網頁像這樣:
<form name="form1" id="form1" action="xxx.php" method="POST"> <input type=text name=a1 id=a1 value=""> //以下幾種按鈕的寫法: <input type="button" value="按鈕1" onclick="submitSend();"> //主流瀏覽器、IE Tester、KKMan 都正常 .submit() <a href="javascript:btnSend();">按鈕2</a> // 主流瀏覽器、IE Tester、KKMan 可以執行 .submit() <a href="javascript:" onclick="javascript:btnSend();">按鈕3a</a> // IE Tester、KKMan 都不行 .submit() . 主流瀏覽器正常 <a href="javascript:" onclick="javascript:btnSend(); return false;">按鈕3b</a> // 主流瀏覽器、IE Tester、KKMan 可以執行 .submit() </form> <script> function submitSend() { $('#form1').submit(); } </script> note: 主流瀏覽器指 IE8+、FireFox 15、Chrome 22、Safari 5
另外 jquery 有一段說明
http://api.jquery.com/submit/
Additional Notes:
Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.