在确认框中单击“确定”后,我试图通过 URL 传递要删除的项目的 ID,但是没有任何反应。这确实适用于 IE,但我希望它也适用于 Chrome。
<script>
function dltCnfrm(id)
{
var r=confirm("Delete this product?")
if (r)
{
window.location.href = "http://localhost/e-com/index.php/product/delete_item/" + id;
}
}
</script>
html里面的代码
foreach ($items as $res) {
$id = $res['id'];
.
.
<td><?php echo "<a href='' onclick='dltCnfrm($id)'>Delete</a>"; ?></td>
我还尝试了其他几种方法,包括
location.assign();
添加返回假;在 if 语句下方
有人可以用 Chrome 浏览器试试吗?Chrome 版本 24.0.1312.57 m