2011-04-12 223 views
0

这很简单,我有一个链接列表,如果用户点击一个链接div加载了一些内容(jwplayer占位符和歌曲标题)和jwplayer应该启动。这是我的JavaScript(jQuery和jQuery的swfobject的):IE9中的JW播放器不会加载和播放MP3文件

$(function() { 
    $('.song a').live('click', function() { 
     var title = $(this).find('span.title').text(); 
     var file = $(this).attr('href'); 
     $.ajax({ 
      type: 'POST', 
      url: $('.songlocation').html(), 
      data: 'name=' + title + '&file=' + file, 
      success: function(html) { 
       $('.songplayer').attr('title', title); 
       $('.songplayer').html(html); 
      }, 
      complete: function(request, status) { 
       $('#mediaspace').flash({ 
        swf: $('.flashlocation').html(), 
        allowfullscreen: true, 
        allowscriptaccess: 'always', 
        wmode: 'opaque', 
        width: 238, 
        height: 24, 
        flashvars: 
         { 
          file: file, 
          autostart: true 
         } 
       }); 

       if ($('#mediaspace').text().indexOf("Flash is disabled") == -1) { 
        $('.songplayer').show(); 
       } else { 
        document.location = file; 
       } 
      } 
     }); 
     return false; 
    }); 
}); 

$( 'songlocation')中包含/主页/ SongPlayer

/主页/ SongPlayer包含:

<div id="mediaspace"> 
    Flash is disabled 
</div> 

<div id="name"> 
    Song Title 
</div> 

<a href="http://url/to.mp3" class="download">Download MP3 &gt;&gt;</a> 

该作品在Opera/Firefox/Chrome/IE7/IE8中完美无瑕,但在IE9中没有问题 jwplayer加载得很好,但不是歌曲。所以在IE9中永远不会调用MP3文件

回答