echo "<td><a onclick=\"confirm('Are you sure you want to permanently delete this post?');\" href='posts.php?id=".$res['id']."'>view</a></td>";
用PHP生成,确认没有弹出..我做错了什么?谢谢你看。
echo "<td><a onclick=\"confirm('Are you sure you want to permanently delete this post?');\" href='posts.php?id=".$res['id']."'>view</a></td>";
用PHP生成,确认没有弹出..我做错了什么?谢谢你看。
利用
onclick="return confirm('Are you sure you want to permanently delete this post?');"
尝试:
echo "<td><a onclick='return confirm('Are you sure you want to permanently delete this post?');' href='posts.php?id=".$res['id']."'>view</a>";
改用:
echo "<td><a onclick="return confirm('Are you sure you want to permanently delete this post?');" href="posts.php?id=".$res['id']."'>view</a></td>";
confirm
返回true
或false
添加 return false 或 true 以避免进一步执行
if(Confirm())
return true;
else
return false;