Javascript SCRIPT5007:无法获取属性“SetReturnValue”的值:对象为空或未定义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7523509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 02:35:39  来源:igfitidea点击:

SCRIPT5007: Unable to get value of the property 'SetReturnValue': object is null or undefined

javascriptflashwordpressinternet-explorer

提问by Josh

I have a page that works perfectly in all other browsers but breaks in IE. The error from the debugger is:

我有一个页面可以在所有其他浏览器中完美运行,但在 IE 中会中断。调试器的错误是:

SCRIPT5007: Unable to get value of the property 'SetReturnValue': object is null or undefined

SCRIPT5007:无法获取属性“SetReturnValue”的值:对象为空或未定义

It happens when I click a button in a flash object to call a function. None of the buttons in the flash file work in IE but all work flawlessly in the other browsers. Anyone have any ideas? I've googled and really couldn't figure it out from the answers out there.

当我单击 Flash 对象中的按钮来调用函数时会发生这种情况。flash 文件中的所有按钮都不能在 IE 中工作,但在其他浏览器中都可以完美地工作。谁有想法?我用谷歌搜索过,真的无法从那里的答案中弄清楚。

The web address is http://capitolomaha.com/reservations/

网址是http://capitolomaha.com/reservations/

Any help is much appreciated, this is confusing me so bad.

非常感谢任何帮助,这让我很困惑。

回答by whoisbenli

See http://msdn.microsoft.com/en-us/library/gg622942%28v=VS.85%29.aspx

请参阅http://msdn.microsoft.com/en-us/library/gg622942%28v=VS.85%29.aspx

Basically, IE9 breaks flash ExternalInterface calls if your flash component is embedded with an object tag with an embed tag fallback, and the object id and embed name is the same.

基本上,如果您的 Flash 组件嵌入了带有 embed 标记回退的对象标记,并且对象 ID 和嵌入名称相同,则 IE9 会中断 Flash ExternalInterface 调用。

The easiest workaround is to tell ie9 to render your page in IE8 Standards mode. To do this, insert this in the element:

最简单的解决方法是告诉 ie9 在 IE8 标准模式下呈现您的页面。为此,请将其插入到元素中:

<!-- Enable IE8 Standards mode -->
<meta http-equiv="X-UA-Compatible" content="IE=8" >

Otherwise, you might just want to use the object tag only or embed tag only.

否则,您可能只想使用对象标签或仅嵌入标签。

回答by Pedro Carvalho

Much of the time, this can be caused because of an embedded object swf video player (for example: JW Player etc.)

大多数情况下,这可能是由于嵌入对象 swf 视频播放器(例如:JW 播放器等)导致的。

Internet Explorer seems to require two attributes for the OBJECTtag, namely classidAND id

Internet Explorer 似乎需要OBJECT标签的两个属性,即classidAND id

For a SWF player use:

对于 SWF 播放器,请使用:

classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"

id="dummy"

NB - in principle, id can be any (non-taken) dummy string

注意 - 原则上, id 可以是任何(未采用的)虚拟字符串

Other good sources on how to embed video:

关于如何嵌入视频的其他好资源:

http://www.w3schools.com/html/html_object.asp

http://www.w3schools.com/html/html_object.asp

http://www.2webvideo.com/blog/embed-swf-flv-mp4-videos-in-webpage

http://www.2webvideo.com/blog/embed-swf-flv-mp4-videos-in-webpage

回答by orafaelreis

Try to verify if the element is null like below:

尝试验证元素是否为空,如下所示:

if(element == null)return false

回答by Arthur Clemens

Make sure you specify the id tag (it must have the same value as the name tag). Although Adobe writesthat idis an optional tag, Internet Explorer needs the id to address the swf object with the javascript-flash interface.

确保您指定了 id 标签(它必须与 name 标签具有相同的值)。尽管Adobe 将id为可选标记,但 Internet Explorer 需要 id 才能使用 javascript-flash 接口寻址 swf 对象。

回答by Andrei Baidoc

I had the same issue, I've solve it by changing the way I've included the flash. Fristly I had

我遇到了同样的问题,我通过更改包含闪光灯的方式来解决它。首先我有

<object>
<embed></embed></object>
</object>

Than i moved to:

比我搬到:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
        <param name="movie" value="myContent.swf" />
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
        <!--<![endif]-->
          <p>Alternative content</p>
        <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>

and with the last one it works.

和最后一个它的工作原理。

回答by Josh

It's a JavaScript error when you click on a button in flash. The button calls a javascript function to reveal a booking source to make a reservation for that particular table. It's frustrating me big time.

当您单击 Flash 中的按钮时,这是一个 JavaScript 错误。该按钮调用一个 javascript 函数来显示预订来源,以便为该特定餐桌进行预订。这让我很沮丧。

The issue only happens in IE, nothing else, but when I debug it's a javascript error as far as I can tell.

这个问题只发生在 IE 中,没有其他问题,但是当我调试时,据我所知,这是一个 javascript 错误。