0
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生成,确认没有弹出..我做错了什么?谢谢你看。

4

4 回答 4

3

利用

onclick="return confirm('Are you sure you want to permanently delete this post?');"
于 2013-09-05T10:36:44.867 回答
2

尝试:

echo "<td><a onclick='return confirm('Are you sure you want to permanently delete this post?');' href='posts.php?id=".$res['id']."'>view</a>";
于 2013-09-05T10:35:45.487 回答
1

改用:

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返回truefalse

于 2013-09-05T10:37:20.600 回答
0

添加 return false 或 true 以避免进一步执行

    if(Confirm())
           return true;
        else
          return false;
于 2013-09-05T10:35:03.023 回答