码迷,mamicode.com
首页 > 编程语言 > 详细

javascript flash 弹框

时间:2014-07-06 22:55:20      阅读:460      评论:0      收藏:0      [点我收藏+]

标签:style   http   java   color   width   os   

1. [代码]FlashBox     
// JavaScript Document
function FlashBox(src,width,height){
var docbody = document.body; 
var _w = docbody.offsetWidth; 
var _x = parseInt((_w-width) / 2);



var screendiv = document.createElement("div");
screendiv.style.cssText = ‘width:100%; height:100%; bottom:0; background:#000; filter:Alpha(opacity=80);opacity:0.8; z-index:998;position:fixed;_position:absolute;z-index:10;top:0;_top:expression(eval(document.documentElement.scrollTop));‘;http://www.huiyi8.com/css3/?


var panel = document.createElement("div");
panel.style.cssText = ‘ position:absolute; z-index:999; left:‘+ _x +‘px;  width:‘+width+‘px; height:‘+height+‘px; position:fixed;_position:absolute;z-index:10;top:200px;_top:expression(eval(document.documentElement.scrollTop+200)+"px"); border:3px solid #000; ‘;

var close = document.createElement("div");
close.style.cssText = ‘position:absolute; z-index:999; top:-24px; right:-24px; width:30px; cursor:pointer; height:30px; background:url(closebox.png)‘;


var iframe= document.createElement("iframe"); 
iframe.style.cssText = ‘display:block; width:100%; height:100%‘;
iframe.width = iframe.height = "100%"; 
iframe.scrolling="no";css3教程
iframe.setAttribute("frameborder","0");

panel.appendChild(close);
panel.appendChild(iframe);


docbody.appendChild(screendiv);
docbody.appendChild(panel);


var newDoc = iframe.contentWindow.document.open("text/html","replace");
var txt = ‘<html><style type="text/css">*{ margin:0; padding:0}</style><body>‘+
‘<embed height="‘+height+‘" width="‘+width+‘" src="‘+src+
‘" type="application/x-shockwave-flash" scale="showall" play="true" loop="true" menu="true"></embed></body></html>‘; 

newDoc.write(txt);
newDoc.close();

close.onclick=function(){ 
panel.parentNode.removeChild(panel);
screendiv.parentNode.removeChild(screendiv); 
} 

}
//demo
FlashBox(‘http://player.youku.com/player.php/Type/Folder/Fid/15455979/Ob/1/Pt/0/sid/XMzA1NzIwMTI4/v.swf‘,600,400);

javascript flash 弹框,布布扣,bubuko.com

javascript flash 弹框

标签:style   http   java   color   width   os   

原文地址:http://www.cnblogs.com/xkzy/p/3824373.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!