Javascript 如何在IE 11中向html动态添加flash对象?
我看到了,但是有用于嵌入的静态html代码。 我尝试通过JS动态使用,但奇怪的是。flash播放器嵌入到页面中。但是swf电影——不是。我觉得名字参数有问题。但我猜不出该怎么做才对 静态(工作) 我试着做了很多组合,但都不起作用 这个问题对IE11来说非常重要。对于其他版本,即下一个代码:Javascript 如何在IE 11中向html动态添加flash对象?,javascript,flash,internet-explorer-11,embedded-flashplayer,Javascript,Flash,Internet Explorer 11,Embedded Flashplayer,我看到了,但是有用于嵌入的静态html代码。 我尝试通过JS动态使用,但奇怪的是。flash播放器嵌入到页面中。但是swf电影——不是。我觉得名字参数有问题。但我猜不出该怎么做才对 静态(工作) 我试着做了很多组合,但都不起作用 这个问题对IE11来说非常重要。对于其他版本,即下一个代码: var node=document.createElement('object'); document.body.appendChild(node); node.classid= "clsi
var node=document.createElement('object');
document.body.appendChild(node);
node.classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
node.movie="menu.swf"
...
我的代码中有两个错误 主要功能-对象组装后,添加到DOM的对象必须是:
var node=document.createElement('object');
node.type="application/x-shockwave-flash"
node.data="menu.swf"
node.width="300"
node.height="300"
document.body.appendChild(node); // must be in end
或
下一个功能-html头中有标记:
<meta http-equiv="X-UA-Compatible" content="IE=9">
如果IE11发现X-UA-Compatible小于11/edge,则需要老式嵌入式闪存(classid)。如果没有X-UA-Compatible或值为11/edge-则需要html中的新样式type=“application/X-shockwave-flash”
var node=document.createElement('object');
node.type="application/x-shockwave-flash"
node.data="menu.swf"
node.width="300"
node.height="300"
document.body.appendChild(node); // must be in end
var node=document.createElement('object');
node.setAttribute('type',"application/x-shockwave-flash")
node.setAttribute('data',"menu.swf")
node.setAttribute('width',"300")
node.setAttribute('height',"300")
document.body.appendChild(node); // must be in end
<meta http-equiv="X-UA-Compatible" content="IE=9">