iframe框架页面如下:

<!DOCTYPE html>
<html lang="zh">
<head>
<meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1'/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=10">
<title></title>

</head>
<body onload="abc();">
<iframe width="20%" height="500px" src="${pageContext.request.contextPath}/cw/mainTree.do" name="mainTree" frameborder="0" scrolling="yes" style="float: left;"></iframe>
<iframe width="80%" height="500px" src="${uploadPath }" name="contentIFrame" id="contentIFrame" frameborder="0" scrolling="yes" style="float: right;"></iframe>

</body>
<script>
function abc(){
timer = setInterval('addListener()',1000)
}
function addListener(){
    cpWindow = window.frames["contentIFrame"];
    if(cpWindow.cpAPIEventEmitter){
        cpWindow.cpAPIEventEmitter.addEventListener("CPAPI_MOVIEPAUSE",function(a,b,c,d){
                            alert(7);
                            });
        clearInterval(timer);
    }
}
</script>
</html>

触发事件,脱离iframei显示的页面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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=UTF-8"/>
    <title>jQuery treeview</title>
    
    <link rel="stylesheet" href="/courseware-tool/resources/css/jquery.treeview.css" />
    <!-- <link rel="stylesheet" href="../red-treeview.css" /> -->
    <link rel="stylesheet" href="/courseware-tool/resources/css/screen.css" />
    <script src="/courseware-tool/resources/js/jquery.js" type="text/javascript"></script>
    <script src="/courseware-tool/resources/js/jquery.cookie.js" type="text/javascript"></script>
    <script src="/courseware-tool/resources/js/jquery.treeview.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    $(document).ready(function(){
        $("#browser").treeview({
            toggle: function() {
                console.log("%s was toggled.", $(this).find(">span").text());
            }
        });
    });
    function playCw(obj){
        window.parent.location.href="${pageContext.request.contextPath}/cw/playCw.do?cwId="+obj;
    }
    </script>
    </head>
    <body>
    
    <h1 id="banner"><a href="javascript:void(0)">课程播放</a></h1>
    <div id="main">
    <ul id="browser" class="filetree treeview-famfamfam">
        <li><span class="folder">课程名称</span>
            <ul>
            <c:if test="${not empty list }">
                <c:forEach items="${list }" var="list">
                    <li><span class="folder" onclick="playCw('${list.cwId}')">${list.cwName }</span>
                        <ul>
                            <c:if test="${not empty list.cwInfo }">
                                <c:forEach items="${list.cwInfo }" var="list">
                                    <li><span class="file" onclick="playCw('${list.cwId}')">${list.cwName }</span></li>
                                    <c:if test="${not empty list.cwInfo }">
                                        <c:import url="mainTreeContent.jsp" />
                                    </c:if>
                                </c:forEach>
                            </c:if>
                        </ul>
                    </li>
                </c:forEach>
            </c:if>
            </ul>
        </li>
    </ul>
</div>
</body>
</html>

重点解析:

window.parent.location.href="${pageContext.request.contextPath}/cw/playCw.do?cwId="+obj;

当前iframe的父框架显示内容

window.parent.contentIFrame.location.href="${pageContext.request.contextPath}/cw/playCw.do?cwId="+obj";

window.parent取父框架显示

window.parent.contentIFrame取子框架显示

最新文章

  1. 深入理解javascript对象系列第二篇——属性操作
  2. python多线程之Event(事件)
  3. Leetcode 66 Plus One STL
  4. Thrift在Windows及Linux平台下的安装和使用示例
  5. atitit.mp4&#160;视频文件多媒体格式结构详解
  6. OpenGLES 2.0 可编程渲染管线
  7. shell 编程中使用到得if语句内判断参数
  8. [AngularJS] Test an Angular Component with $componentController
  9. Java RMI远程方法调用
  10. win7使用右键导致死机、假死、explorer无法响应的解决方法
  11. 使用微信 SDK 上传图片到七牛
  12. Delphi代码中嵌入ASM代码
  13. 【转载】跟我一起学习VIM - vim插件
  14. PHP保留两位小数并且四舍五入及不四舍五入的方法
  15. Fiddler抓包11-HTTPS证书Actions无法导出问题
  16. 在服务器运行一个jar包,不用时终止它
  17. 在AbpZero中hangfire后台作业的使用——开启hangfire
  18. Linux下编译busybox时出现的问题
  19. HDU 6061 推导 NTT
  20. form表单设置input文本属性只读,不可更改

热门文章

  1. spring - ioc和aop
  2. gotoTop返回顶部 JS
  3. iBatisnet系列(二) 配置运行环境和日志处理
  4. boost库(条件变量)
  5. C++ map 映照容器
  6. NYOJ 77 开灯问题
  7. 织梦dedecms调用子栏目的方法
  8. Java中数据类型及其之间的转换
  9. Python2.x与Python3.x的区别
  10. AppSettingManager