layer.open 调用子类窗口方法, 子类调用父类方法
<!-- 父类 -->
var index = layer.open({
type : 2,
title : title,
shadeClose : true,
shade : 0.8,
area : [ '500px', '380px' ],
content : _BasePath + 'z/b/b/l',
btn: ['进入', '关闭'],
btn1: function(){
// 父类调用子类方法
var fh = window["layui-layer-iframe" + index].onEnter();
alert(JSON.stringify(fh))
},
btn2: function(){
layer.closeAll(); //关闭窗口
},
end:function(){]
// 清除session里缓存
document.location.href= _BasePath + "logout";
}
});
<!-- 子类页面 -->
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html lang="zh-CN">
<head>
<title></title>
<meta charset="utf-8">
<%
String path = request.getContextPath();
String basePath = path + "/";
%>
<base id="basePath" href="<%=basePath%>">
<script type="text/javascript">
var _BasePath = "<%=basePath%>";
</script>
<jsp:include page="/WEB-INF/head.jsp" />
</head>
<script type="text/javascript">
function onEnter(){
var fh = {
msg:"error"
};
return fh;
}
</script>
<body>
<div class="prop-window"></div>
</body>
</html>