js 删除确认 点击取消为什么还是成功删除了 求解
js部分:functiondel(){varmsg="您真的确定要删除吗?\n\n请确认!";if(confirm(msg)==true){returntrue;}els...
js部分:function del() {
var msg = "您真的确定要删除吗?\n\n请确认!";
if (confirm(msg)==true){
return true;
}else{
return false;
}
}
删除的按钮:
<form name="delete" method=post action="delete.php">
<INPUT class="Btn BtnNml" hideFocus type=submit value="删除邮件" outClass="Btn BtnNml" overClass="Btn BtnHv" onclick="del();">
</form>
提交的表单php:
<?php
session_start();
include 'conn.php';
mysql_query("delete from message where id='".$_SESSION['id']."'");
echo"<script>alert('删除成功');location='inbox.php';</script>";
?> 展开
var msg = "您真的确定要删除吗?\n\n请确认!";
if (confirm(msg)==true){
return true;
}else{
return false;
}
}
删除的按钮:
<form name="delete" method=post action="delete.php">
<INPUT class="Btn BtnNml" hideFocus type=submit value="删除邮件" outClass="Btn BtnNml" overClass="Btn BtnHv" onclick="del();">
</form>
提交的表单php:
<?php
session_start();
include 'conn.php';
mysql_query("delete from message where id='".$_SESSION['id']."'");
echo"<script>alert('删除成功');location='inbox.php';</script>";
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询