为何我的立刻执行函数不论点击确定还是取消都会执行后面代码?

tomorrower 2017-03-05 08:00:22
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage=""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:useBean id="db" class="com.cn.BEService.connectDB" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>删除计划产量</title>
</head>

<body>
<%
String dwbh = request.getParameter("dwbh");
dwbh = new String(dwbh.getBytes("ISO-8859-1"), "utf-8");
String nd = request.getParameter("nd");
String id = request.getParameter("id");
%>
<script type="text/javascript">
(function(dwbh,nd){
if (confirm("确定删除单位编号"+dwbh+"在"+nd+"年度计划产量吗?")==false){
alert("确定删除");
return ;
}
}('<%=dwbh%>',<%=nd%>));

</script>
<%
int cnt = 0;
String sql3 = "DELETE FROM BENDJHCL where id=? ";
cnt = db.executeUpdate(sql3, id);
db.closeDB();
%>
<%
if (cnt > 0) {
%>
<script>
alert("成功删除<%=dwbh%>在<%=nd%>年度计划产量");</script>

<%} else {%>
<script>
alert("<%=dwbh%>产量删除<%=nd%>计划产量失败");</script>
<script>
<%}%>
<script>window.navigate("jhclcx.jsp")</script>
</body>
</html>
...全文
81 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tomorrower 2017-03-05
  • 打赏
  • 举报
回复
如何停在执行删除?我发现是return的问题,这里的return没有起作用
tomorrower 2017-03-05
  • 打赏
  • 举报
回复
奇怪的是我点击了弹出框的取消按钮,已经会执行后面的alet("准备删除")

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧