(1)父页面调用模态窗口的方法和设置付页面的重新加载时间方法
//模态窗口
function execlImport(){
var feature = "dialogWidth:800px;dialogHeight:500px;scroll:yes;status:no;help:no;center:1";
var win=window.showModalDialog("assistmanage/dutymanage/dutyplanmanage/chooseExecl.jsp",window, feature);
}
//设置重新加载时间
function reload123(){
setTimeout("reload3()",4000);
}
//重新加载页面
function reload3(){
location.reload(true);
}
(2)
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!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>
<base target="_self" />//不弹出新页面
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>北京市残疾人联合会</title>
</head>
<script src="js/common.js"></script> <script>
function insertinsertExeclDutyPlan()//模态窗口调用action,调用完action 关闭该窗口,并重新加载父页面
{
var file=document.getElementById("fileId").value;
if(file.match(/\.(xls)$/i)==null)
{
alert('文件格式错误!只能为xls格式!');
}
else
{
insertExeclDutyPlanForm.action="insertExeclDutyPlan.action";
insertExeclDutyPlanForm.submit();
var VarObject=window.dialogArguments;//调用父页面的重新加载函数
VarObject.reload123();
window.close();
}
}
</script>
<style type="text/css">
<!--
.exportwrap {
width: 480px;
height: 100%;
margin: 0 auto;
margin-top: 100px;
}
.choose {
width: 100%;
height: 100%;
padding: 10px;
padding-left:15px;
margin: 10px 0;
border: 1px solid #CACACA;
background: #F4F4F4;
}
.line {
height: 32px;
line-height: 32px;
margin-bottom:5px;
}
#file_name {
border: none;
height: 22px;
}
.button {
width:50px;
height:24px;
}
span.ttip {
color:#999; font-size:12px;
}
-->
</style>
<body style="background:none">
<div class="exportwrap">
<form name="insertExeclDutyPlanForm" method="post" action=" insertExeclDutyPlan.action" enctype="application/x-www-form-urlencoded" onSubmit="return false;">
<s:hidden name="returnURL"/>
<div class="choose">
<div class="line" >
选择上传文件:
<input id="fileId" name="upload" size="20" type="file" class="pInput" />
</div>
<label>
<div class="line" align="center">
<input type="button" name="button" class="button" id="button" value="导入" οnclick="insertinsertExeclDutyPlan()" />
<input type="reset" name="button2" class="button" id="button" value="取消" οnclick="window.close()" />
</div>
</label>
</div>
</form>
</div>
</body>
</html>