我有一个从 PHP 请求返回的表单。该表单有一个提交按钮和一个常规按钮。提交似乎工作得很好,但普通的就不行了!请指教。
这是我的 HTML:
<tr id='actionRow' name='actionRow' hidden='hidden'>
<td>
<input class='actionBtn' type='submit' id='confirm' name='confirm'
value='Confirm' onclick='genChanged();'/>
</td>
<td>
<input class='actionBtn' type='button' id='cancel' name='cancel'
value='Cancel' onclick='cancel();' />
</td>
</tr>
这是 cancel() 函数:
function cancel(){
alert('in cancel');
document.getElementById('editRow').hidden = false;
document.getElementById('actionRow').hidden = true;
window.location.replace("admin.php");
};
警报永远不会出现!
将多个非提交按钮放在一个表单中是否正确?
更新 我的表格看起来像:
<form action='save.php' method='POST' id='myForm'>
我已将该行添加document.getElementById('myForm').submit();
到getChange(); 功能,使按钮成为:
<input class='actionBtn' type='button' id='confirm' name='confirm'
value='Confirm' onclick='genChanged();'/>
然而,取消();功能还是不行!