Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript没有';我不在IE8工作_Javascript_Flash_Dom_Internet Explorer 8 - Fatal编程技术网

Javascript没有';我不在IE8工作

Javascript没有';我不在IE8工作,javascript,flash,dom,internet-explorer-8,Javascript,Flash,Dom,Internet Explorer 8,然而,我试图在我的页面上动态地创建这个html元素;当我运行它时,代码在IE8上不起作用,但在firefox、safari和其他浏览器上可以。 function getmovie() { var container = document.getElementById("container"); if (!container) return; var object = document.create

然而,我试图在我的页面上动态地创建这个html元素;当我运行它时,代码在IE8上不起作用,但在firefox、safari和其他浏览器上可以。

 function getmovie() {
           var container = document.getElementById("container");
           if (!container)
               return;
           var object = document.createElement("object");
           object.setAttribute("width", "512");
           object.setAttribute("height", "296");
           var param1 = document.createElement("param");
           param1.setAttribute("name", "movie");
           param1.setAttribute("value", "url");
           var param2 = document.createElement("param");
           param2.setAttribute("name", "allowFullScreen");
           param2.setAttribute("value", "true");
           var embed = document.createElement("embed");
           embed.setAttribute("src", "my url");
           embed.setAttribute("type", "application/x-shockwave-flash");
           embed.setAttribute("allowFullScreen", "true");
           embed.setAttribute("width", "512");
           embed.setAttribute("height", "296");
           object.appendChild(param1);
           object.appendChild(param2);
           object.appendChild(embed);
           container.appendChild(object);
           }

函数getmovie(){
var container=document.getElementById(“容器”);
如果(!容器)
返回;
var object=document.createElement(“对象”);
setAttribute(“宽度”、“512”);
setAttribute(“高度”、“296”);
var param1=document.createElement(“param”);
param1.setAttribute(“名称”、“电影”);
param1.setAttribute(“值”、“url”);
var param2=document.createElement(“param”);
param2.setAttribute(“名称”、“allowFullScreen”);
param2.setAttribute(“值”、“真”);
var embed=document.createElement(“嵌入”);
setAttribute(“src”,“我的url”);
嵌入.setAttribute(“类型”、“应用程序/x-shockwave-flash”);
setAttribute(“allowFullScreen”、“true”);
setAttribute(“宽度”、“512”);
setAttribute(“高度”、“296”);
object.appendChild(param1);
object.appendChild(param2);
追加子对象(嵌入);
container.appendChild(object);
}

有人能更正我的代码吗?< /p> ,除非你有一个很好的理由来手动构建你的Flash,包括手动的DOM元素,考虑用一个单一的调用来替换代码,这样的框架会为你做所有的“肮脏工作”。

除非你有一个很好的理由来手动构建你的Flash,包括手动的DOM元素,考虑用一个单一的调用来替换代码,这样的框架会为你做所有的“肮脏的工作”。


这可能是原因吗

中断


如果不是这样,请尝试设置对象标记的codebase和classid属性 反对


这可能是原因吗

中断


如果不是这样,请尝试设置对象标记的codebase和classid属性 反对


不能使用
.setAttribute('name',value)设置IE中任何元素的
name
属性

您需要使用:

param1.name = 'movie';//works

param1.setAttribute("name", "movie");//will fail

注意:(只要您在IE8标准模式下运行)

您不能使用
.setAttribute('name',value)设置IE中任何元素的
名称
属性

您需要使用:

param1.name = 'movie';//works

param1.setAttribute("name", "movie");//will fail

注意:(只要您在IE8标准模式下运行)

请将此转换为人们可以运行的“工作”示例,然后我们可以提供帮助。请将此转换为人们可以运行的“工作”示例,然后我们可以提供帮助。问题可能不是getElementById()因为Firefox和Safari也会阻塞。问题可能不是getElementById(),因为Firefox和Safari也会阻塞。+1,这是您应该做的。SWFObject比任何你可能尝试的东西都要安全得多,+1,绝对是你应该做的。SWFObject比任何你可能尝试的东西都安全,
param1.name = 'movie';//works

param1.setAttribute("name", "movie");//will fail