另类调用flash无须激活的方法


Posted in Javascript onDecember 27, 2006
<script type="text/javascript"> 
/**  
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/  
 *  
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:  
 * http://www.opensource.org/licenses/mit-license.php  
 *  
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for  
 *   legal reasons.  
 */  
if(typeof deconcept=="undefined"){var deconcept=new Object();}  
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}  
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}  
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){  
if(!document.createElement||!document.getElementById){return;}  
this.DETECT_KEY=_b?_b:"detectflash";  
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);  
this.params=new Object();  
this.variables=new Object();  
this.attributes=new Array();  
if(_1){this.setAttribute("swf",_1);}  
if(id){this.setAttribute("id",id);}  
if(w){this.setAttribute("width",w);}  
if(h){this.setAttribute("height",h);}  
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}  
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);  
if(c){this.addParam("bgcolor",c);}  
var q=_8?_8:"high";  
this.addParam("quality",q);  
this.setAttribute("useExpressInstall",_7);  
this.setAttribute("doExpressInstall",false);  
var _d=(_9)?_9:window.location;  
this.setAttribute("xiRedirectUrl",_d);  
this.setAttribute("redirectUrl","");  
if(_a){this.setAttribute("redirectUrl",_a);}};  
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){  
this.attributes[_e]=_f;  
},getAttribute:function(_10){  
return this.attributes[_10];  
},addParam:function(_11,_12){  
this.params[_11]=_12;  
},getParams:function(){  
return this.params;  
},addVariable:function(_13,_14){  
this.variables[_13]=_14;  
},getVariable:function(_15){  
return this.variables[_15];  
},getVariables:function(){  
return this.variables;  
},getVariablePairs:function(){  
var _16=new Array();  
var key;  
var _18=this.getVariables();  
for(key in _18){  
_16.push(key+"="+_18[key]);}  
return _16;  
},getSWFHTML:function(){  
var _19="";  
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){  
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}  
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";  
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";  
var _1a=this.getParams();  
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}  
var _1c=this.getVariablePairs().join("&");  
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}  
_19+="/>";  
}else{  
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}  
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";  
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";  
var _1d=this.getParams();  
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}  
var _1f=this.getVariablePairs().join("&");  
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}  
_19+="</object>";}  
return _19;  
},write:function(_20){  
if(this.getAttribute("useExpressInstall")){  
var _21=new deconcept.PlayerVersion([6,0,65]);  
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){  
this.setAttribute("doExpressInstall",true);  
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));  
document.title=document.title.slice(0,47)+" - Flash Player Installation";  
this.addVariable("MMdoctitle",document.title);}}  
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){  
var n=(typeof _20=="string")?document.getElementById(_20):_20;  
n.innerHTML=this.getSWFHTML();  
return true;  
}else{  
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}  
return false;}};  
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){  
var _25=new deconcept.PlayerVersion([0,0,0]);  
if(navigator.plugins&&navigator.mimeTypes.length){  
var x=navigator.plugins["Shockwave Flash"];  
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}  
}else{try{  
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");  
for(var i=3;axo!=null;i++){  
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);  
_25=new deconcept.PlayerVersion([i,0,0]);}}  
catch(e){}  
if(_23&&_25.major>_23.major){return _25;}  
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){  
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}  
catch(e){}}}  
return _25;};  
deconcept.PlayerVersion=function(_29){  
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;  
this.minor=parseInt(_29[1])||0;  
this.rev=parseInt(_29[2])||0;};  
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){  
if(this.major<fv.major){return false;}  
if(this.major>fv.major){return true;}  
if(this.minor<fv.minor){return false;}  
if(this.minor>fv.minor){return true;}  
if(this.rev<fv.rev){return false;}return true;};  
deconcept.util={getRequestParameter:function(_2b){  
var q=document.location.search||document.location.hash;  
if(q){  
var _2d=q.indexOf(_2b+"=");  
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;  
if(q.length>1&&_2d>-1){  
return q.substring(q.indexOf("=",_2d)+1,_2e);  
}}return "";}};  
if(Array.prototype.push==null){  
Array.prototype.push=function(_2f){  
this[this.length]=_2f;  
return this.length;};}  
var getQueryParamValue=deconcept.util.getRequestParameter;  
var FlashObject=deconcept.SWFObject; // for backwards compatibility  
var SWFObject=deconcept.SWFObject;  
</script> 

使用方法:
<style type="text/css"> 
<!-- 
body { 
    margin-left: 0px; 
    margin-top: 0px; 
    margin-right: 0px; 
    margin-bottom: 0px; 
} 
--> 
</style> 
<table width="10%" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td><div id="flashmovyy" ></div> 
    <script type="text/javascript">    
   var fo = new SWFObject("yanyuan.swf", "mymyy", "580", "386", "7", "");    
   fo.addParam("quality", "best");    
   fo.addParam("salign", "t");    
   fo.addParam("scale", "noscale");    
  fo.addParam("loop", "true");    
   fo.write("flashmovyy");    
 </script></td> 
  </tr> 
</table>
Javascript 相关文章推荐
理解Javascript_11_constructor实现原理
Oct 18 Javascript
代码获取历史上的今天发生的事
Apr 11 Javascript
Jquery实现textarea根据文本内容自适应高度
Apr 03 Javascript
jquery实现的Banner广告收缩效果代码
Sep 02 Javascript
AngualrJS中的Directive制作一个菜单
Jan 26 Javascript
JavaScript中splice与slice的区别
May 09 Javascript
AngularJS表单验证功能分析
May 26 Javascript
JS查找数组中重复元素的方法详解
Jun 14 Javascript
Bootstrap Tooltip显示换行和左对齐的解决方案
Oct 11 Javascript
layer弹出层倒计时关闭的实现方法
Sep 27 Javascript
vue中更改数组中属性,在页面中不生效的解决方法
Oct 30 Javascript
JavaScript分页组件使用方法详解
Jul 26 Javascript
完美解决JS中汉字显示乱码问题(已解决)
Dec 27 #Javascript
通用于ie和firefox的函数 GetCurrentStyle (obj, prop)
Dec 27 #Javascript
从javascript语言本身谈项目实战
Dec 27 #Javascript
JavaScript实现禁止后退的方法
Dec 27 #Javascript
utf8的编码算法 转载
Dec 27 #Javascript
ie和firefox中img对象区别的困惑
Dec 27 #Javascript
使用javascript访问XML数据的实例
Dec 27 #Javascript
You might like
PHP获取当前文件所在目录 getcwd()函数
2009/05/13 PHP
Symfony2学习笔记之控制器用法详解
2016/03/17 PHP
thinkPHP5 tablib标签库自定义方法详解
2017/05/10 PHP
JQuery 动态扩展对象之另类视角
2010/05/25 Javascript
基于jQuery实现的Ajax 验证用户名是否存在的实现代码
2011/04/06 Javascript
IE下使用cloneNode注意事项分享
2012/11/22 Javascript
通过JS自动隐藏手机浏览器的地址栏实现原理与代码
2013/01/02 Javascript
js全屏显示显示代码的三种方法
2013/11/11 Javascript
node.js中的fs.fstat方法使用说明
2014/12/15 Javascript
浅谈javascript的分号的使用
2015/05/12 Javascript
JS实现窗口加载时模拟鼠标移动的方法
2015/06/03 Javascript
基于chosen插件实现人员选择树搜索自动筛选功能
2016/09/24 Javascript
Base64(二进制)图片编码解析及在各种浏览器的兼容性处理
2017/02/09 Javascript
JavaScript实现256色转灰度图
2017/02/22 Javascript
Bootstrap多级菜单的实现代码
2017/05/23 Javascript
微信小程序动态添加分享数据
2017/06/14 Javascript
简易Vue评论框架的实现(父组件的实现)
2018/01/08 Javascript
vue router导航守卫(router.beforeEach())的使用详解
2019/04/19 Javascript
[01:24]2014DOTA2 TI第二日 YYF表示这届谁赢都有可能
2014/07/11 DOTA
[50:20]DOTA2上海特级锦标赛主赛事日 - 5 总决赛Liquid VS Secret第四局
2016/03/06 DOTA
python 连接sqlite及简单操作
2017/06/30 Python
Python BS4库的安装与使用详解
2018/08/08 Python
Python读取YUV文件,并显示的方法
2018/12/04 Python
python根据文章标题内容自动生成摘要的实例
2019/02/21 Python
Python 实现数据结构中的的栈队列
2019/05/16 Python
pytorch自定义初始化权重的方法
2019/08/17 Python
python 识别登录验证码图片功能的实现代码(完整代码)
2020/07/03 Python
iKRIX意大利网上商店:男女豪华服装和配件
2019/10/09 全球购物
幼教毕业生自我鉴定
2014/01/12 职场文书
前厅收银主管岗位职责
2014/02/04 职场文书
建筑工程质量通病防治方案
2014/06/08 职场文书
办公用房租赁协议书
2014/11/29 职场文书
2015安全保卫工作总结
2015/04/25 职场文书
感恩教育主题班会
2015/08/12 职场文书
银行工作心得体会范文
2016/01/23 职场文书
vue项目配置sass及引入外部scss文件
2022/04/14 Vue.js