去除flash边框虚框的方法代码
2010-01-21 11:59
239 查看
各位在设计、制作或者处理自己的blog的时候会遇到插入flash文件,自己在IE打开这个页面后,flash上面会浮现一个虚框,需要点击一次后才可以操作。程序繁琐,不免让喜欢简单的朋友觉得复杂。另外虚框也影响了网页的整体美观性和体验性。
这里分享一段代码,只要在网页中插入,所有swf文件的虚框将会消失,是不是很得意呢?哈哈,代码如下:
将其保存为flash_no.js,在你需要的前台页面head中加入:
flash_no.js:
原文地址:http://yourxin.com/blog/article.asp?id=46
这里分享一段代码,只要在网页中插入,所有swf文件的虚框将会消失,是不是很得意呢?哈哈,代码如下:
将其保存为flash_no.js,在你需要的前台页面head中加入:
<head>
…
<scripttype="text/javascript"src="script/flash_no.js"></script>
</head>
flash_no.js:
/**
*@author[cengis]Mihawk
*@versionv1.0
*Date:2007-6-21
*/
varie=(document.defaultCharset&&document.getElementById&&!window.home);
varopera9=false;
if(ie){
varver=navigator.appVersion.split("MSIE")
ver=parseFloat(ver[1])
ie=(ver>=6)
}elseif(navigator.userAgent.indexOf("Opera")!=-1){
varversionindex=navigator.userAgent.indexOf("Opera")+6
if(parseInt(navigator.userAgent.charAt(versionindex))>=9)
opera9=true;
}
varoswap=(ie||opera9)
if(oswap){
document.write("<styleid='hideObject'>object{display:none;}</style>");
}
objectSwap=function(){
if(!document.getElementsByTagName){
return;
}
varstripQueue=[];
varobjects=document.getElementsByTagName('object');
for(vari=0;i<objects.length;i++){
varo=objects[i];
varh=o.outerHTML;
varparams="";
varhasFlash=true;
for(varj=0;j<o.childNodes.length;j++){
varp=o.childNodes[j];
if(p.tagName=="PARAM"){
if(p.name=="flashVersion"){
hasFlash=detectFlash(p.value);
if(!hasFlash){
o.id=(o.id=="")?("stripFlash"+i):o.id;
stripQueue.push(o.id);
break;
}
}
params+=p.outerHTML;
}
}
if(!hasFlash){
continue;
}
if(!oswap){
continue;
}
if(o.className.toLowerCase().indexOf("noswap")!=-1){
continue;
}
vartag=h.split(">")[0]+">";
varnewObject=tag+params+o.innerHTML+"</OBJECT>";
o.outerHTML=newObject;
}
if(stripQueue.length){
stripFlash(stripQueue)
}
if(oswap){
document.getElementById("hideObject").disabled=true;
}
}
detectFlash=function(version){
if(navigator.plugins&&navigator.plugins.length){
varplugin=navigator.plugins["ShockwaveFlash"];
if(plugin==undefined){
returnfalse;
}
varver=navigator.plugins["ShockwaveFlash"].description.split("")[2];
return(Number(ver)>=Number(version))
}elseif(ie&&typeof(ActiveXObject)=="function"){
try{
varflash=newActiveXObject("ShockwaveFlash.ShockwaveFlash."+version);
returntrue;
}
catch(e){
returnfalse;
}
}
returntrue;
}
stripFlash=function(stripQueue){
if(!document.createElement){
return;
}
for(vari=0;i<stripQueue.length;i++){
varo=document.getElementById(stripQueue[i]);
varnewHTML=o.innerHTML;
newHTML=newHTML.replace(/<!--\s/g,"");
newHTML=newHTML.replace(/\s-->/g,"");
newHTML=newHTML.replace(/<embed/gi,"<span");
vard=document.createElement("div");
d.innerHTML=newHTML;
d.className=o.className;
d.id=o.id;
o.parentNode.replaceChild(d,o);
}
}
vartempFunc=window.onload;
window.onload=function(){
if(typeof(tempFunc)=="function"){
try{
tempFunc();
}catch(e){}
}
objectSwap();
}
原文地址:
相关文章推荐
- 去除flash边框虚框的方法代码
- 去除flash边框虚框的方法代码
- Python实现去除代码前行号的方法
- 使用CSS表达式去除超链接的虚框的一些方法
- Android 对话框【Dialog】去除白色边框代码
- android dialog边框去除白色边框实现思路及代码
- masterpage 无法用html代码显示flash的解决方法
- FLASH轮换图片广告代码及使用方法
- Android开发实现去除bitmap无用白色边框的方法示例
- 去除html代码里面的script正则方法
- Android 对话框【Dialog】去除白色边框代码
- Android 对话框【Dialog】去除白色边框代码
- Android 对话框【Dialog】去除白色边框代码
- 去除HTML代码中所有标签的两种方法
- 马克斯程序播放器广告代码的去除方法
- 在网上找了一些代码,写的winform上写的一个导出Excel方法,带边框标题
- 将FLASH置底的方法与代码
- Android dialog去除边框代码
- FLASH中的trim方法,去除多余的空格和TAB
- 转:Android 对话框【Dialog】去除白色边框代码