我有这个回声声明:
echo "<td align=center style=border:0>"."<a href='?delete=$row[id]'>Delete</a>"."</td>";
当我按下“删除”时,我怎么能做到这一点?是否会出现对话框?
我在某处读过它可以在语句中的某处添加一些这样的东西:
onClick="javascript:return confirm(\'Are you sure you want to delete this record?\')"
任何帮助将不胜感激。 提前谢谢。
答案 0 :(得分:4)
试试这个:
echo "<td align=center style=border:0><a onclick='return confirm(\"Are you sure you want to delete this record?\")' href='?delete=$row[id]'>Delete</a></td>";
我摆脱了原始代码中不必要的"."
。
答案 1 :(得分:0)
只需使用此
echo "<td align=center style=border:0><a onclick='return confirm(\"Are you sure you want to delete this record?\")' href='?delete=$row[id]'>Delete</a></td>";
而不是
echo "<td align=center style=border:0>"."<a href='?delete=$row[id]'>Delete</a>"."</td>";