SWFObject 1.5 .write(“identifier”)在Internet Explorer中不起作用

时间:2011-03-15 01:07:34

标签: javascript swfobject

我正在使用swfobject 1.5在我的页面上使用.write("indexplayer")放置一个shoutcast播放器,但它在Internet Explorer 8中不起作用。我环顾四周,我发现的唯一信息是尝试将defer="defer"添加到脚本代码中,但这不起作用。

这是我目前的代码:

<div id="indexplayer">
    <div id="player_error">FLASH / JAVASCRIPT ERROR</div>
</div>
<script type="text/javascript">
    var so = new SWFObject("/flash/scplayer.swf", "flashplayer", "280", "26", "8", "#171717");
    so.addParam("flashvars", "basic_variables_to_connect_to_shoutcast_server");
    so.addParam("wmode", "window");
    so.addParam("scale", "noscale");
    so.write("indexplayer");
</script>

1 个答案:

答案 0 :(得分:0)

我使用2.2版并执行以下操作,在每个浏览器中都可以正常工作:

var flashvars = {
        file: 'PATH TO FILE IF THERE IS A FILE',
        autostart: true
    };
    var params = {
        allowfullscreen: true,
        allowscriptaccess: 'always',
        wmode: 'transparent'
    };
    var attributes = {};
    swfobject.embedSWF("/flash/scplayer.swf", 'ID OF THE ELEMENT TO RENDER FLASH IN', WIDTH_OF_THE_FLASH, HEIGHT_OF_THE_FLASH, "9.0.0", false, flashvars, params, attributes);