dqt66847 2013-09-04 10:25
浏览 93
已采纳

单击链接时删除确认

I have this code inside a while loop for fetching data from the database. I want to show a confirmation popup when the Delete link is clicked.

echo "<td><a href='delete.php?id=" . $row['serial_no'] . "'>Delete</a></td>";

How can this be done?

  • 写回答

5条回答 默认 最新

  • drvkf88226 2013-09-04 10:26
    关注

    Try out confirm function from JavaScript, learn jQuery as fast as possible and try to seperate javascript from html ;).

    http://www.w3schools.com/jsref/met_win_confirm.asp

    <td>
        <a href="delete.php?id=<?php echo $row['serial_no'] ?>" id="a_id">
            Delete
        </a>
    </td>
    
    <script type="text/javascript">
        $(function() {
            $('td a#a_id').click(function() {
                return confirm("Are You sure that You want to delete this?");
            });
        });
    </script>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器