另类调用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 相关文章推荐
页面中js执行顺序
Nov 09 Javascript
jQuery学习笔记之控制页面实现代码
Feb 27 Javascript
Javascript数组的排序 sort()方法和reverse()方法
Jun 04 Javascript
ajax异步刷新实现更新数据库
Dec 03 Javascript
JavaScript汉诺塔问题解决方法
Apr 21 Javascript
jQuery-1.9.1源码分析系列(十)事件系统之事件包装
Nov 20 Javascript
AngularJS基础 ng-switch 指令简单示例
Aug 03 Javascript
详解js中==与===的区别
Jan 08 Javascript
JavaScript纯色二维码变成彩色二维码
Jul 23 Javascript
Vue路由守卫及页面登录权限控制的设置方法(两种)
Mar 31 Javascript
Node.js API详解之 zlib模块用法分析
May 19 Javascript
JS如何定义用字符串拼接的变量
Jul 11 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调试的强悍利器之PHPDBG
2016/02/22 PHP
Javascript学习笔记-详解in运算符
2011/09/13 Javascript
js动态创建标签示例代码
2014/06/09 Javascript
js分页工具实例
2015/01/28 Javascript
JavaScript通过prototype给对象定义属性用法实例
2015/03/23 Javascript
浅谈使用MVC模式进行JavaScript程序开发
2015/11/10 Javascript
javascript Promise简单学习使用方法小结
2016/05/17 Javascript
JS组件系列之使用HTML标签的data属性初始化JS组件
2016/09/14 Javascript
a标签置灰不可点击的实现方法
2017/02/06 Javascript
node前端开发模板引擎Jade的入门
2018/05/11 Javascript
vue2 中二级路由高亮问题及配置方法
2019/06/10 Javascript
TypeScript高级用法的知识点汇总
2019/12/17 Javascript
vue基础知识--axios合并请求和slot
2020/06/04 Javascript
three.js显示中文字体与tween应用详析
2021/01/04 Javascript
[51:15]2014 DOTA2国际邀请赛中国区预选赛 Orenda VS LGD-GAMING
2014/05/22 DOTA
理解Python中的类与实例
2015/04/27 Python
Python使用设计模式中的责任链模式与迭代器模式的示例
2016/03/02 Python
Python实现定时任务
2017/02/08 Python
python使用xlsxwriter实现有向无环图到Excel的转换
2018/12/12 Python
python实现比较类的两个instance(对象)是否相等的方法分析
2019/06/26 Python
如何安装并使用conda指令管理python环境
2019/07/10 Python
python rsa-oaep加密的示例代码
2020/09/23 Python
C++和python实现阿姆斯特朗数字查找实例代码
2020/12/07 Python
Python中生成ndarray实例讲解
2021/02/22 Python
CSS3中的元素过渡属性transition示例详解
2016/11/30 HTML / CSS
体育纪念品、亲笔签名的体育收藏品:Steiner Sports
2020/07/31 全球购物
大学生党员自我批评
2014/02/14 职场文书
《胡杨》教学反思
2014/02/16 职场文书
硕士生找工作求职信
2014/07/05 职场文书
2015年团支部工作总结
2015/04/03 职场文书
企业培训简报范文
2015/07/20 职场文书
中秋节随笔
2015/08/15 职场文书
原生JS实现飞机大战小游戏
2021/06/09 Javascript
四十九个javascript小知识实用技巧
2021/11/20 Javascript
PyTorch中的torch.cat简单介绍
2022/03/17 Python
Python字符串的转义字符
2022/04/07 Python