日期:2014-05-17  浏览次数:20951 次

easyUI的Window会加载两次页面数据,求解释???
如题,我把两个关联页面贴出来,高手们帮我看看。

第一个页面如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <link rel="stylesheet" type="text/css" href="admin/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="admin/themes/icon.css" />
<script type="text/javascript" src="admin/js/myjs/mywin.js"></script>
<script type="text/javascript" src="admin/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="admin/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="admin/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
function mywin(v1,wid,hei,tit,ico,hrf){
v1.window({
width:wid,
height:hei,
title: tit,
iconCls: ico,
href:hrf,
left: ($(window).width() - wid) * 0.5,
top: ($(window).height() - hei) * 0.5
});
v1.window('refresh').window('open');
}

function openQueryWin(){
mywin($('#querywin'),820,330,'查询负责人','icon-add','admin/organizeManage/employeeQuery.jsp');
}

</script>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
  </head>
  
  <body>
   <a href="javascript:openQueryWin();">打开窗口</a>
   <div id="querywin" data-options="closed:true,minimizable:false,maximizable:true,collapsible:true" style="background:#e6f6ff;" class="easyui-window"></div>
  </body>
</html>

引用页面如下:
<script type="text/javascript">
$(function(){
alert('弹出消息');
});
</script>
<table>
<tr>
<td>表格</td>
</tr>
</table>


运行后的结果就是,引用页面的js代码会执行两次,我研究的一天也没想明白到底是怎么回事。求高手解释。
javascript jsp

------解决方案--------------------
v1.window('refresh').window('open');
你open一下,refresh一下。
------解决方案--------------------
v1.window('refresh').window('open');
你open一下,refresh一下