- 最后登录
- 2017-5-15
- 注册时间
- 2012-3-1
- 阅读权限
- 90
- 积分
- 32973
  
- 纳金币
- 32806
- 精华
- 12
|
他不能容别的div在他上面吗?
一放上就被放到下面了。
<!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>Untitled Document</title>
<script type="text/javascript" src="postFlash.js"></script>
<script type="text/javascript" src="UnityObject.js"></script>
<style type="text/css">
html,body,div{margin:0;padding:0;}
.main_swf{ position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:1px solid green; z-index:0;}
#sec_swf{ position:absolute;border:1px solid red; background-color:#ff0000; z-index:999;top:0;width:600px; height:400px;}
#close_{ position:absolute;width:25px; height:25px; border:1px solid white; background-color:#CCC;right:0; z-index:999; cursor:pointer;}
#swf_box{ position:absolute;top:0;width:600px; height:400px; border:1px solid green;}
</style>
</head>
<body>
<div class="main_swf" id="swf" style="position:absolute; z-index:1">
</div>
</body>
<script type="text/javascript">
//创建div
var arr=["p1.swf","p2.swf"];
function setDiv(){
sec_swf = document.createElement("div");
sec_swf.setAttribute("id","sec_swf");
document.body.appendChild(sec_swf);
swf_box = document.createElement("div");
swf_box.setAttribute("id","swf_box");
sec_swf.appendChild(swf_box);
close_ = document.createElement("div");
close_.setAttribute("id","close_");
//sec_swf.appendChild(close_);
sec_swf.insertBefore(close_,swf_box);
}
w=document.body.clientWidth||document.documentElement.clientWidth;
h=document.body.clientHeight||document.documentElement.clientHeight;
if (typeof unityObject != "undefined") {
unityObject.embedUnity("swf", "WebPlayer.unity3d", w, h);
}
//加载swf到sec_swf
setDiv();
var flash=new MenuPost(arr[1],"FlashH",600,400,"opaque","#fff","high","page=2")
flash.add("swf_box");
sec_swf.style.visibility = "hidden";
//点击接收un3d的值
function SendToJS(){
//判断是否存在swf_box
if(document.getElementById("sce_swf")||document.getElementById("swf_box")||document.getElementById("close_")){
var flash=new MenuPost(arr[1],"FlashH",600,400,"transparent","#fff","high","page=2")
flash.add("swf_box");
var sec_swf = document.getElementById("sec_swf");
var swf = document.getElementById("swf");
sec_swf.style.visibility = "visible";
sec_swf.style.top = (h - sec_swf.offsetHeight)/2+"px";
sec_swf.style.left = (w - sec_swf.offsetWidth)/2+"px";
}else{
setDiv();
var sec_swf = document.getElementById("sec_swf");
var swf = document.getElementById("swf");
sec_swf.style.visibility = "visible";
sec_swf.style.top = (h - sec_swf.offsetHeight)/2+"px";
sec_swf.style.left = (w - sec_swf.offsetWidth)/2+"px";
var flash=new MenuPost(arr[1],"FlashH",600,400,"transparent","#fff","high","page=2")
flash.add("swf_box");
}
//clos()
clos();
}
function clos(){
var close_ = document.getElementById("close_");
close_.onclick=function(){
var swf_box = document.getElementById("swf_box");
var sec_swf = document.getElementById("sec_swf");
sec_swf.removeChild(swf_box);
document.body.removeChild(sec_swf);
}
}
</script>
</html>
|
|