╋艺 镇╋╋网站网络|程序语言|Flash╋┣◇网站建设&Web语言 → IE中Flash控件的自动激活


  共有17552人关注过本帖树形打印复制链接

主题:IE中Flash控件的自动激活

帅哥哟,离线,有人找我吗?
乐魔舞
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 天之飞雪
等级:青蜂侠 帖子:1427 积分:11370 威望:0 精华:7 注册:2007/12/25 16:21:28
IE中Flash控件的自动激活  发帖心情 Post By:2007/12/27 11:52:18 [只看该作者]

face16|IE中Flash控件的自动激活 |admin||只要在代码之间插入下面的代码就OK.. //出现猴子的图的处理方法,只要引用下此贴就能看到原代码.避免代码错误
以下内容为程序代码:
objectswap.js的代码是 /* ObjectSwap - Bypasses the new ActiveX Activation requirement in Internet Explorer by swapping existing ActiveX objects on the page with the same objects. Can also be used for Flash version detection by adding the param: to the object tag. Author: Karina Steffens, www.neo-archaic.net Created: April 2006 Changes and bug fixes: May 2006 Bug fixes: June 2006 Changes: October 2006 (Included Opera9 and excluded IE5.5) */ //Check if the browser is InternetExplorer, and if it supports the getElementById DOM method var ie = (document.defaultCharset && document.getElementById && !window.home); var opera9 = false; if (ie){ //Check for ie 5.5 and exclude it from the script var ver=navigator.appVersion.split("MSIE") ver=parseFloat(ver[1]) ie = (ver >=6) }else if (navigator.userAgent.indexOf("Opera")!=-1) { //Check for Opera9 and include it in the ObjectSwap var versionindex=navigator.userAgent.indexOf("Opera")+6 if (parseInt(navigator.userAgent.charAt(versionindex))>=9) opera9 = true; } //Perform ObjectSwap if the browser is IE or Opera (if not just check flashVersion) var oswap = (ie ││ opera9) //Hide the object to prevent it from loading twice if (oswap){ document.write (""); } /*Replace all flash objects on the page with the same flash object, by rewriting the outerHTML values This bypasses the new IE ActiveX object activation issue*/ objectSwap = function(){ if (!document.getElementsByTagName){ return; } //An array of ids for flash detection var stripQueue = []; //Get a list of all ActiveX objects var objects = document.getElementsByTagName(''object''); for (var i=0; i if (p.name == "flashVersion"){ hasFlash = detectFlash(p.value); if (!hasFlash){ //Add the objects id to the list (create a new id if there''s isn''t one already) o.id = (o.id == "") ? ("stripFlash"+i) : o.id; stripQueue.push(o.id); break; } } params += p.outerHTML; } } if (!hasFlash){ continue; } //Only target internet explorer if (!oswap){ continue; } //Avoid specified objects, marked with a "noswap" classname if (o.className.toLowerCase().indexOf ("noswap") != -1){ continue; } //Get the tag and attributes part of the outer html of the object var tag = h.split(">")[0] + ">"; //Add up the various bits that comprise the object: //The tag with the attributes, the params and it''s inner html var newObject = tag + params + o.innerHTML + " "; //And rewrite the outer html of the tag o.outerHTML = newObject; } //Strip flash objects if (stripQueue.length) { stripFlash(stripQueue) } //Make the objects visible again if (oswap){ document.getElementById("hideObject").disabled = true; } } detectFlash = function(version){ if(navigator.plugins && navigator.plugins.length){ //Non-IE flash detection. var plugin = navigator.plugins["Shockwave Flash"]; if (plugin == undefined){ return false; } var ver = navigator.plugins["Shockwave Flash"].description.split(" ")[2]; return (Number(ver) >= Number(version)) } else if (ie && typeof (ActiveXObject) == "function"){ //IE flash detection. try{ var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version); return true; } catch(e){ return false; } } //Catchall - skip detection return true; } //Loop through an array of ids to strip //Replace the object by a div tag containing the same innerHTML. //To display an alternative image, message for the user or a link to the flash installation page, place it inside the object tag. //For the usual object/embed pairs it needs to be enclosed in comments to hide from gecko based browsers. stripFlash = function (stripQueue){ if (!document.createElement){ return; } for (var i=0; i/g, ""); //Neutralise the embed tag newHTML = newHTML.replace(/ 只要把这个代码命名为objectswap.js放在根目录下就OK |2007-6-13 21:00:16


  
平面设计、网站建设、三维动画、视频制作 联系QQ:114103945  回到顶部