日期:2014-05-17  浏览次数:20567 次

html button造成的form重复提交

form中使用<button>标签而非<input/>标签造成了form重复提交,并且ajax请求也无法正常响应!?

此问题虽小,却困扰了半天!?

<form action=""> 
<button id="" name=""></button> 
</form> 

这样写button会造成两次提交!在ie6下不会,在ie8或者firefox4以上都会.?

所以好的写法是 使用 <input type='button'/>?

?

最好的写法是:??

<form action=""> 
  <input type='button'/> 
</form> 

?或者?

<form action="" onsubmit='return false'> 
<button id="" name=""></button> 
</form> 

或者?

<form action=""> 
<button id="" name=""></button> 
</form> 

当按钮点击了一次之后,将按钮设置为不可用. button.disabled=true