删除条目时的确认对话框--confirm

1
2
3
4
5
6
7
<td>  
<a href="/mem/edit_ppt/<?php echo $id;?>" >编辑</a>
<a href="javascript:;"
onclick="if(confirm('您确定删除这条记录?')){location.href='/mem/del_ppt/<?php echo $id;?>';}" >
删除
</a>
</td>

注:php脚本中如果使用header('Location: /member/life/shop/');进行重定向的话,我想先输出提示信息再进行页面跳转的话,用header()无法实现(这个函数之前不能有任何输出),此时也可以用js来实现:echo "<script>alert('操作成功!');location.href='/member/life/add_shop/';</script>";

如果alert输出的是乱码,要先确认文件的编码格式,然后在echo之前加上:header("Content-Type: text/html; charset=utf-8");