关于模态窗口刷新父窗口传递参数的问题
我的问题是当我门打开一个模态窗口的时候,关闭模态窗口我门可以获得子窗口传递过来的参数,我现在实现了在子窗口里点"确定"以后子窗口关闭,父窗口刷新,这样刷新以后就不能保存原来子窗口传递过来的参数,真的不行了,哪个大侠帮帮忙啊我的代码如下:
<%@ page contentType="text/html; charset=gb2312" %>
父页面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../analysis/css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/calendar.js"></script>
<script language="javascript">
var CalendarWebControl = new atCalendarControl();
</script>
</head>
<script language="javascript">
//打开选择县市窗口
function addCounty(){
var tempBussinessId = new Array;//传递已经选好的业务编号以便于进行比较
var tempCountyId = new Array;//当再次打开窗口时为了看到以前勾选的内容必须传递前次勾选县市编号
var countyId = '';
var aaa;
alert("BaseDataForm.countyId.value="+document.BaseDataForm.countyId.value);
//alert("BaseDataForm.bussinessId.value="+BaseDataForm.bussinessId.value);
//将已经选择的业务转化为数组
if (BaseDataForm.bussinessId.value != 'undefined' && BaseDataForm.bussinessId.value.length > 1) {
tempBussinessId = BaseDataForm.bussinessId.value.split(',');
}
//将已经选择的县市转化为数组
if (BaseDataForm.countyId.value != 'null' && BaseDataForm.countyId.value != 'undefined') {
alert("进来了");
tempCountyId = BaseDataForm.countyId.value.split(',');
}
//alert("数组tempCountyId长度为"+tempCountyId.length);
//alert("数组tempBussinessId长度为"+tempBussinessId.length);
var tempBC = new Array(tempBussinessId,tempCountyId);
aaa = window.showModalDialog("../analysis/SelectCounty.jsp?aaa=1",tempBC,
"dialogHeight: 400px; dialogWidth: 200px;dialogTop: 150px; dialogLeft: 500px;center: No;resizable: Yes;" );
document.BaseDataForm.countyId.value = aaa;
if (aaa != undefined) {
document.BaseDataForm.countyId.value = aaa;
window.location.reload(1);
}
document.BaseDataForm.countyId.value = aaa;
alert("BaseDataForm.countyId.value="+document.BaseDataForm.countyId.value);
}
//打开选择业务窗口
function addBussiness(){
var tempCountyId = new Array;
var bbb;
if (BaseDataForm.countyId.value != 'undefined' && BaseDataForm.countyId.value.length > 1) {
tempCountyId = BaseDataForm.countyId.value.split(',');
}
bbb = showModalDialog("../analysis/SelectBussiness.jsp?type=0&aaa=1",tempCountyId,
"dialogHeight: 400px; dialogWidth: 220px;dialogTop: 150px; dialogLeft: 715px;center: Yes;resizable: Yes;" );
BaseDataForm.bussinessId.value = bbb;
if (bbb != undefined) {
window.location.reload(1);
}
}
//显示图表
function showGraph(content){
if (BaseDataForm.Sys_BeginDate.value == "") {
alert("请输入开始时间!");
return false;
}
if (BaseDataForm.Sys_EndDate.value == "") {
alert("请输入结束时间!");
return false;
}
if (BaseDataForm.countyId.value == null || BaseDataForm.countyId.value == 'null' || BaseDataForm.countyId.value == '' || BaseDataForm.countyId.value == 'undefined') {
alert("请选择县市!");
return false;
}
if (BaseDataForm.bussinessId.value == null || BaseDataForm.bussinessId.value == 'null' || BaseDataForm.bussinessId.value == '' || BaseDataForm.bussinessId.value == 'undefined') {
alert("请选择业务!");
return false;
}
BaseDataForm.action = "/selectquerydata?type="+content;
return true;
}
</script>
<body>
<form name="BaseDataForm" method="post">
<table width="100%" height="38" border="0" cellpadding="0" cellspacing="0" background="images/bg_toptitl.gif">
<tr>
<td width="48"><img src="images/tb_tit_sj.gif" width="40" height="29" align="absmiddle"></td>
<td width="94%"><span class="titcolor">全市发展情况基础数据表 </span> 显示各县市分公司每天各品牌各种服务计划的业务发展情况</td>
</tr>
</table>
<img src="../analysis/images/buttonl_selectcounty.gif" align="absmiddle" onclick="return addCounty();">
<img src="../analysis/images/buttonl_selectoperation.gif" align="absmiddle" onclick="return addBussiness();">
</span></td>
</tr>
</table>
<table width="100%" height="38" border="0" cellpadding="0" cellspacing="0" background="images/showtitbg.gif">
<tr>
<td width="59%" height="38" align="center">选择数据图浏览类型 ( 默认类型:数据表格 )</td>
<td width="41%" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table></td>
</tr>
</table>
<table width="100%" height="490" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
</table>
<input type="hidden" name="countyId" value="<%=strTempCountyId%>">
<input type="hidden" name="bussinessId" value="<%=strTempBussinessId%>">
</form>
</body>
</html>
子页面
select_county:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/select.js"></script>
</head>
<script language="javascript">
function sendTo(){
var CountyId = '';
var tempBussinessId = new Array;//业务
var tempDealerId = new Array;//运营商
var tempCountyId = new Array;//县市
var tempArray = new Array;
var count = 0;
for(var i=0;i<form1.select_county.length;i++){
if (document.form1.select_county[i].checked == true)
{
count = count + 1;
CountyId = CountyId + document.form1.select_county[i].value + ',';
}
}
if (form1.num.value == '1') {
var tempBC = new Array(tempBussinessId,tempCountyId);
tempBC = window.dialogArguments;//存放传递过来的业务编号和县市编号
tempBussinessId = tempBC[0];//业务
tempCountyId = tempBC[1];//县市
alert("tempCountyId.value.length="+tempCountyId.value.length);
for(var i=0;i<form1.select_county.length;i++){
for(var k=0;k<tempCountyId.length;k++){
if(tempCountyId[k].value == form1.select_county[i].value){
document.form1.select_county[i].checked == true;
}
}
}
if (tempBussinessId.length - 1 > 1 && count > 1) {
alert("业务已经多选,县市目前只能单选!");
}
}
if (form1.num.value == '2') {
tempArray = window.dialogArguments;
tempBussinessId = tempArray[0];
tempDealerId = tempArray[1];
if (tempBussinessId.length - 1 > 1 && count > 1) {
alert("业务县市已经多选,县市目前只能单选!");
}
if((tempDealerId.length - 1) > 1 && count > 1){
alert("运营商已经多选,县市目前只能单选!");
return false;
}
}
if(tempCountyId == ''){
alert("请选择县市!");
return false;
}
window.returnValue = tempCountyId;
window.close();
}
</script>
<body>
<form name="form1">
<table border="0" cellspacing="12" cellpadding="0">
<tr>
<td><table border="0" cellpadding="0" cellspacing="8" class="maintablekuang">
</table></td>
<td valign="middle">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/buttonl_selectall.gif" width="63" height="21" border="0" onclick="selectAll()"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><img src="images/buttonl_selectallno.gif" width="63" height="21" border="0" onclick="clearAll()"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><img src="images/button_confirm.gif" width="63" height="21" border="0" onclick="sendTo()"></td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="num" value=<%=weiNum%>>
</form>
</body>
</html>
问题点数:0、回复次数:1Top
1 楼awaysrain(绝对零度)(既然选择了远方就要日夜前行)回复于 2005-03-04 08:53:31 得分 0
呵呵,你刷新了页面当然参数会丢了,想办法在页面刷新前保存参数然,比如用cookie等Top




