当我在弹出的消息上单击cancel时,它仍然删除记录,我不知道为什么。
<tr>
<td class="recordCells">
<div align="center">
<a onclick="confirm('Are you sure you want to delete this record?')" href="deleterecord.php?ID=<?php echo $row_rsInventory['ID']; ?>">
<img src="../images/x.png" align="absmiddle">
</a>
</div>
</td>
</tr>发布于 2016-08-05 19:13:36
不返回确认框的值:
<tr>
<td class="recordCells">
<div align="center">
<a onclick="return(confirm('Are you sure you want to delete this record?'))" href="deleterecord.php?ID=<?php echo $row_rsInventory['ID']; ?>">
<img src="../images/x.png" align="absmiddle">
</a>
</div>
</td>
</tr>发布于 2016-08-05 19:23:22
实际上在锚标签中有一个"href = deleterecord.php文件“的问题,所以你可以使用类似这样的代码:
jQuery(".confirm_click").click(function(){
var check = confirm("Are you sure you want to delete this record?");
if(check == true){
// Action - Record deleted
var url= jQuery(this).attr("url");
jQuery(location).attr('href',url);
}else{
// Action - none
}
});Html代码:-
<a class="confirm_click" href="" url="deleterecord.php?ID=<?php echo $row_rsInventory['ID']; ?>">
<img src="../images/x.png" align="absmiddle">
</a>或者你可以把"mohit.tiwari@techinfini.com“上的一部分代码发给我,我会以适当的方式编写它。
https://stackoverflow.com/questions/38787772
复制相似问题