我有以下代码,它Form
动态创建了许多 s,这些 s 具有Input
链接到文件 delObservation.php 然后删除记录的按钮。我想包含一个Confirm
函数并添加了这个脚本。出现Confirm
消息框,但即使我在确认消息框上单击“取消”,delObservation.php 仍然会被调用。我究竟做错了什么?
<script language="JavaScript" type="text/javascript">
function checkDelete(){
return confirm('Are you sure you want to delete this record?');
}
</script>
<form name="deleteReport" action="http://www.website/delRecord.php" method="Post">
<input name="recordID" type="submit"
value="<?php echo$row['recordID'] ?>" class="delButton"
onclick="checkDelete()" >
</form>