swfobject.embedSWF不会在IE7和IE8中加载对象

时间:2011-01-19 21:58:59

标签: internet-explorer swfobject

我的代码在ff,opera和chrome中运行得非常好:

<script type="text/javascript">
                    $(document).ready(function(){
                      var swfUrl = "http://www.youtube.com/apiplayer?video_id=<?php echo bg_get_video_id($post->post_content)?>&enablejsapi=1&version=3&playerapiid=ytplayer_<?php echo $i?>";


                      // allowScriptAccess must be set to allow the Javascript from one 
                      // domain to access the swf on the youtube domain
                      var params = { allowScriptAccess: "always", wmode: "opaque" };

                      // This sets the ID of the DOM object or embed tag to 'myytplayer'.
                      // You can use this ID to access the swf and call the player's API
                      var atts = { id: "ytplayer_<?php echo $i?>", class: "ytplayer"};
                      var flashvars = {};
                      swfobject.embedSWF(swfUrl, "ytdiv_<?php echo $i?>", "300", "120", "9", null, flashvars, params, atts);
                    });
                </script>   

但不是在Internet Explorer版本7和8中。它是来自Wordpress的php文件的一部分,但它并不重要 - video_id和ytdiv_都可以,它可以在其他浏览器中使用。

我有什么办法可以让它在IE中运行吗?我对可能导致它的原因一无所知。

干杯, Nebril

2 个答案:

答案 0 :(得分:2)

下面:
var atts = { id: "ytplayer_", "class": "ytplayer"};

输入引号“class”,您就完成了。它至少帮助了我。

答案 1 :(得分:1)

我不知道这是否与我遇到的问题相同,但我不得不升级到最新版本的swfobject,2.2我认为现在已经解决了这个问题。