日期:2014-05-16  浏览次数:20442 次

jQuery 阻止form表单提交 请大侠指点
<form name='saveForm' action="updateColumn.aspx" method="post" onkeydown="if(event.keyCode==13){return false}" > 
<input type="hidden" name="tablename" id ="tablename" value="a4"/> <tr class="ttgreen2" style="table-layout: fixed;">
<td><input type="text" id="id0NotEmpty" name="id" class="InpKey" value="0" onfocus="keyfocus(this);" onblur="keyblur(this);" style="width: 100%"/></td>
<td><input type="text" id="class0NotEmpty" name="class" class="InpKey" value="2" onfocus="keyfocus(this);" onblur="keyblur(this);" style="width: 100%"/></td>
<td><input type="text" id="time" name="time" class="InpKey" size="50" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true})" value="2012-3-25" onfocus="keyfocus(this);" onblur="keyblur(this);" style="width: 80%"/></td>
<td><input type="text" id="price0NotEmpty" name="price" class="InpKey" value="32.5400" onfocus="keyfocus(this);" onblur="keyblur(this);" style="width: 100%"/></td>
<td width="200">
 <input type="text" name="notAutoSubmit" style="display:none"/>
 <input type="submit" class="cx_btn" id ="0" value="保存"/> 
 <input type="button" class="cx_btn" onclick="del('a4','id','0','varchar');"value="删除" /></td>
</tr>
 <input type ="hidden" name ="priname" id ="priname" value ="id">
 <input type ="hidden" name ="pritype" id ="pritype" value ="varchar">
 <input type ="hidden" name ="privalue" id ="privalue" value ="0">
 </form>


  $(":submit").click(function(check) {

  代码处理。。。。
  return false;
  alert("hello");


});

(1)如何在click事件中阻止表单提交
(2)另外click已经return false 但下面的alert还是执行,没有返回。为什么?

------解决方案--------------------
1)return false可以阻止表单提交,未阻止只能说return false前面的代码出错了

2)这种问题不可能发生