由于工作需要,两个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 οnlοad="abc();">
<iframe width="20%" height="500px" src="/courseware-tool/jsp/mainTree.jsp" name="contentIFrame" 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>
重点是:iframe的代码,要想横着显示
加上:style="float: right;"即可。