javascript – IE10 / Safari无法隐藏iFrame中的对象/ Flash

我在iFrame中有一个Flash动画.当我试图隐藏它时,IE10会保持显示并重叠其他内容.
Here an example.

<body style="background-color: #EEE">
    Testing IE10
    <div id="swfDiv">
        <iframe src="swf.html" width="500" height="50"></iframe>
        <br />
        <button onclick="document.getElementById('swfDiv').style.display='none'">Hide</button>
    </div>
    <div style="background-color: #DDD">
        This try to hide the animation, but it is not working on IE10.  <br/> It works fine in others browsers and earlier versions of IE.
    </div>
</body>

更新02/08/2013
我在Safari(5.1.7)中发现了同样的问题

解决方法:

显然,最好的解决方案是将其移出屏幕:

.xhide
{
    display: block;
    position: absolute;
    left:-9999px;
}

我们可以在点击时添加这个类来隐藏它,例如:

document.getElementById('swfDiv').className = "xhide";

相关文章

  译序:JWMediaPlayer是开源的网页使用的Flash播放器。本...
    Flash编程原理都是只能将1写为0,而不能将0写成1.所...
 上传setenvgatewayip192.168.1.1;setenvserverip192.168.1...
Error:FlashDownloadFailed-"Cortex-M3"出现一般有...
jPlayer是一个用于控制和播放mp3文件的jQuery插件。它在后台...
#ifndef__FONTUPD_H__#define__FONTUPD_H__#include"sy...