弹出模态窗口后,点击提交后如何关闭当前的模态窗口?也不要弹出另外的一个页面? 弹出模态窗口后,由于是对数据库进行操作,执行action中的方法后,我在点击提交之后如何关闭当前的模态窗口?也不要弹出另外的一个页面?在JSP中如何实现,或者是在action中如何去实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 此回复为自动发出,仅用于显示而已,并无任何其他特殊作用楼主【weixiangerdou】截止到2008-08-01 13:32:22的历史汇总数据(不包括此帖):发帖的总数量:38 发帖的总分数:930 每贴平均分数:24 回帖的总数量:31 得分贴总数量:0 回帖的得分率:0% 结贴的总数量:38 结贴的总分数:930 无满意结贴数:4 无满意结贴分:175 未结的帖子数:0 未结的总分数:0 结贴的百分比:100.00% 结分的百分比:100.00% 无满意结贴率:10.53 % 无满意结分率:18.82 % 敬礼!取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=weixiangerdou 提交之后关闭xxx.submit("xxx.do");window.close(); 是这样的,点提交后,action返回的flag值,赋给页面的某个组件,js判断该组件值,为多少时关闭窗口... js提交document.form.action = xxx;document.form.submit();window.close(); form.submit(); window.close(); 我是这样写的,还是贴出来大家看来,我试过,怎么还是不行啊!jsp文件:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ include file="/include/head.jsp"%><!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"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><link rel="stylesheet" rev="stylesheet" href="<%=request.getContextPath()%>/system/basedate/images/style.css" type="text/css" media="all" /><script type="text/javascript" src="datepicker/onsubmit.js" language="javascript"></script><title>审批报表管理</title></head><body bgcolor="#EFEFED"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="25" class="title"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2%" align="center"><img src="images/arr1.gif" align="middle" /></td> <td width="98%">当前操作:审批报表</td> </tr></table></td> </tr> <tr> <td><html:form action="/Rdapproveblock.do?method=updatesFlag" method="post" styleId="form1"><table align="center" border=1 cellspacing=5 borderColor=#FFFFFF bgcolor="#EFEFED" rules=all style=" WIDTH:90; "> <input type="hidden" value="${reporteeddetail.reportNo}" name="reportno" /> <tr> <tr> <td > 报表编码: ${reporteeddetail.reportNo} </td> </tr> <tr> <td> 报告单位: ${reporteeddetail.orgName} </td> </tr> <tr> <td>评价 <select name="appraise" > <option value="肯定">肯定</option> <option value="很可能">很可能</option> <option value="可能">可能</option> <option value="可能无关">可能无关</option> <option value="待评价">待评价</option> <option value="无法评价">无法评价</option> <option vlaue="简要评价">简要评价</option> </select> </td> </tr> <tr> <td>评价简要 <p><textarea name="appraiseContent" cols="40" rows="10"></textarea></p> </td> </tr> <tr> <td> 签名:<%=request.getAttribute("username")%> </td> </tr> </tr> <td><p align="center"><input type="submit" value="提 交" onClick="tosave();" /> <input type="button" value="取 消" onClick="self.close();"/></p></td></table> <html:hidden name = "adrReportForm" property="reportNo"/></html:form></body></html>JS文件:function tosave(){// Rdapproveblock.submit("Rdapproveblock.do"); // window.close(); document.form.action = Rdapproveblockaction; document.form.submit(); window.close();} <input type="submit" value="提 交" onClick="function(this.form){form.submit();window.close();return false;}" />这样行不行? 以下页面就是点击“审批通过”按扭时,就弹出上面模态窗口的那个页面:审批报表管理function approveGo(){ var reportNo = document.form1.reptno.value; //alert(reportNo); var str = window.showModalDialog("<%=request.getContextPath()%>/Rdapproveblock.do?method=SearchAppriseInfoNo&reportno="+reportNo,null, "resizable:yes;scroll:yes;status:no;dialogWidth=550px;dialogHeight=450px;center=yes;help=no"); } </script> </head> <body> <form name="form1" action="/Rdapproveblock.do?method=SearchAdrReport" method="post"> <input type="hidden" name="reptno" value="${reporteeddetail.reportNo}" /> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bgbutton"> <tr> <td width="70%" align="right"> </td> <td width="45%"> <input class="cpage" onclick="approveGo();" type="button" value=" 审批通过 " name="sub" /> <input class="cpage" onclick="javascript:window.print();" type="button" value=" 打 印 " name="print" /> <input class="cpage" onclick="javascript:window.close();" type="button" value=" 返 回 " name="close" /> </td> </tr> </table> <br /> 点击”提交“按扭后,action中的方法被执行了,也执行了onClick事件,数据提交成功了,保存到了数据库中!为什么它还是没有关闭窗口,当我点击”取消“按扭的时候,也是激发了这个onClick事件,它就关闭了这个窗口! 在body标签上面加<base target="_self"> 在后台action里response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter();String = "<script>alert('XXX');window.close();</script" out.println(reStr); 谢谢大家!关闭当前的窗口的问题解决了,但它弹出了一个空的网页出来,如何让它提交之后,不要弹出一个页面出来,在提交时,执行了指向action里面的方法,JSP中指向的路径是这样的:<html:form action="/Rdapproveblock.do?method=updatesFlag" method="post" styleId="form1">提交之后,就弹出了一个网页里面什么都没有:http://localhost:8888/adr/Rdapproveblock.do?method=updatesFlag我在action的要执行的方法中已经将它return null了,请问不要弹出这个网页,应该怎么做啊? <html:form action="/Rdapproveblock.do?method=updatesFlag" target="_self" method="post" styleId="form1"> 初学struts,遇到困难了,高手求解 求助字符串分页的实现 做一个网上考试系统,考试期间需要锁定窗口、禁止访问网络、U盘,程序怎么做? jsp中基于数字证书的身份认证问题请教,跪求高人指点!!!!!!!!!!!!!!!!!!! 不配odbc,能不能连接数据库? <jsp:include>问题.大家帮我看看,怎么解决..急! 请教域名服务功能~在线等 jsp按钮事件问题? 学jsp最好看什么书啊??? 我要买JDBC for SQL Server7.0的jar驱动,谢谢! JSP 删除cookie在firefox,opera下不能用啊 help~~ 编程时间长了,是不是做网站就无师自通了。
楼主【weixiangerdou】截止到2008-08-01 13:32:22的历史汇总数据(不包括此帖):
发帖的总数量:38 发帖的总分数:930 每贴平均分数:24
回帖的总数量:31 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:38 结贴的总分数:930
无满意结贴数:4 无满意结贴分:175
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:100.00%
无满意结贴率:10.53 % 无满意结分率:18.82 %
敬礼!
取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=weixiangerdou
xxx.submit("xxx.do");
window.close();
document.form.submit();
window.close();
window.close();
jsp文件:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/head.jsp"%>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" rev="stylesheet" href="<%=request.getContextPath()%>/system/basedate/images/style.css" type="text/css" media="all" />
<script type="text/javascript" src="datepicker/onsubmit.js" language="javascript"></script>
<title>审批报表管理</title>
</head><body bgcolor="#EFEFED">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" class="title"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2%" align="center"><img src="images/arr1.gif" align="middle" /></td>
<td width="98%">当前操作:审批报表</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><html:form action="/Rdapproveblock.do?method=updatesFlag" method="post" styleId="form1">
<table align="center" border=1 cellspacing=5 borderColor=#FFFFFF bgcolor="#EFEFED" rules=all style=" WIDTH:90; "> <input type="hidden" value="${reporteeddetail.reportNo}" name="reportno" />
<tr>
<tr>
<td >
报表编码: ${reporteeddetail.reportNo}
</td>
</tr>
<tr>
<td>
报告单位: ${reporteeddetail.orgName}
</td>
</tr>
<tr>
<td>评价
<select name="appraise" >
<option value="肯定">肯定</option>
<option value="很可能">很可能</option>
<option value="可能">可能</option>
<option value="可能无关">可能无关</option>
<option value="待评价">待评价</option>
<option value="无法评价">无法评价</option>
<option vlaue="简要评价">简要评价</option>
</select>
</td>
</tr>
<tr>
<td>评价简要
<p><textarea name="appraiseContent" cols="40" rows="10"></textarea></p>
</td>
</tr>
<tr>
<td>
签名:<%=request.getAttribute("username")%>
</td>
</tr>
</tr>
<td><p align="center"><input type="submit" value="提 交" onClick="tosave();" /> <input type="button" value="取 消" onClick="self.close();"/></p></td>
</table> <html:hidden name = "adrReportForm" property="reportNo"/>
</html:form>
</body>
</html>
JS文件:function tosave(){// Rdapproveblock.submit("Rdapproveblock.do");
// window.close();
document.form.action = Rdapproveblockaction;
document.form.submit();
window.close();
}
这样行不行?
var reportNo = document.form1.reptno.value;
//alert(reportNo);
var str = window.showModalDialog("<%=request.getContextPath()%>/Rdapproveblock.do?method=SearchAppriseInfoNo&reportno="+reportNo,null,
"resizable:yes;scroll:yes;status:no;dialogWidth=550px;dialogHeight=450px;center=yes;help=no");
}
</script> </head> <body>
<form name="form1" action="/Rdapproveblock.do?method=SearchAdrReport" method="post">
<input type="hidden" name="reptno" value="${reporteeddetail.reportNo}" />
<table width="100%" border="0" cellpadding="0" cellspacing="0"
class="bgbutton">
<tr>
<td width="70%" align="right">
</td>
<td width="45%">
<input class="cpage" onclick="approveGo();" type="button"
value=" 审批通过 " name="sub" />
<input class="cpage" onclick="javascript:window.print();"
type="button" value=" 打 印 " name="print" />
<input class="cpage" onclick="javascript:window.close();"
type="button" value=" 返 回 " name="close" />
</td>
</tr>
</table>
<br />
为什么它还是没有关闭窗口,当我点击”取消“按扭的时候,也是激发了这个onClick事件,它就关闭了这个窗口!
PrintWriter out = response.getWriter();
String = "<script>alert('XXX');window.close();</script"
out.println(reStr);
执行了指向action里面的方法,JSP中指向的路径是这样的:<html:form action="/Rdapproveblock.do?method=updatesFlag" method="post" styleId="form1">
提交之后,就弹出了一个网页里面什么都没有:http://localhost:8888/adr/Rdapproveblock.do?method=updatesFlag
我在action的要执行的方法中已经将它return null了,请问不要弹出这个网页,应该怎么做啊?