我有如下一段其刪除時,刪除圖像被點擊的JavaScript validation-- ONCLICK
<tr> To replace the document, you will need to first delete the current one.
<form name="delete_attachment_form" action="apr_attachment.cfc?method=delete_apr_attachment" method="post">
<input type="hidden" name="apr_attachment_id" value="#apr_attachment_id#">
<input type="hidden" name="apr_section_id" value="#apr_section_id#">
<input type="hidden" name="submit_mode" value="DELETE">
<input type="image" name="submit" src="images/delete.gif" alt="DELETE">
</form>
</tr>
現在我要修改這和圖像變爲按鈕,並把一些基本的JS文件代碼驗證,以便它在刪除之前詢問確認消息。
我有這個作爲我的代碼到目前爲止
<tr> To replace the document, you will need to first delete the current one.
<form name="delete_attachment_form" action="apr_attachment.cfc?method=delete_apr_attachment" method="post">
<input type="hidden" name="apr_attachment_id" value="#apr_attachment_id#">
<input type="hidden" name="apr_section_id" value="#apr_section_id#">
<input type="hidden" name="submit_mode" value="DELETE">
<input type="button" onClick ="return confirm('Are you sure you want to delete the current project activities document')" name="submit" Value="Delete">
</form>
</tr>
但在頁面當我點擊這個按鈕,任何人都可以指出什麼發生在這裏沒有改變/影響?由於
不宜按鈕是類型=「提交」的? – BoltBait
「onClick」的eventListener在哪裏? – DevlshOne
@DevlshOne你不能看到? – nicael