<form onsubmit="return confirm('Are you sure you want to rollback deletion of candidate table?')">
<input type='submit' name='delete' value='Undo' />
<input type='submit' name='no' value='No' />
当用户点击第二个提交按钮,即不想我将确认对话框显示为“您确定要提交交易吗?”
<form method='post'>
<input type='submit' name='undo' value='Undo' onclick="return confirm('Are you sure you want to rollback deletion of candidate table?')"/>
<input type='submit' name='no' value='No' onclick="return confirm('Are you sure you want to commit delete and go back?')"/>
</form>
工作得很好.刚刚将onsubmit()更改为onclick().因为在这种情况下两者的功能是相同的.