Title: 为什么这段代码中form的onSubmit无效?
Post by: ejzhang on November 24, 2012, 09:02:10 AM
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>form</title> <link rel="stylesheet" type="text/css" href="/jquery-easyui-1.3.1/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="/jquery-easyui-1.3.1/themes/icon.css"> <script type="text/javascript" src="/jquery-easyui-1.3.1/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="/jquery-easyui-1.3.1/jquery.easyui.min.js"></script> <script type="text/javascript" src="/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script> <script type="text/javascript"> <!-- $(function(){ var $frmAddnew = $('#frmAddnew'); $frmAddnew.form({ onSubmit:function(){ alert('ok');return false; }, success:function(data){ alert(data); } }); }); //--> </script> </head> <body> <form name="frmAddnew" method="post"> <input type="text" id="" /> <input type="submit" /> </form> </body> </html> 帮忙看下为什么这段代码中form的onSubmit不执行呢?谢谢!
Title: Re: 为什么这段代码中form的onSubmit无效?
Post by: stworthy on November 25, 2012, 01:15:36 AM
The id attribute is missing in the form element. Replace the form code with: <form id="frmAddnew" name="frmAddnew" method="post"> ... </form
Title: Re: 为什么这段代码中form的onSubmit无效?
Post by: ejzhang on December 14, 2012, 07:42:10 AM
居然没发现这个问题 :(
|