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.οnclick=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);
转载于:https://www.cnblogs.com/xkzy/p/3824373.html