2011-11-03 62 views
1
<EMBED id = "player" 
         TYPE="application/x-mplayer2" 
         NAME="MediaPlayer" 
         WIDTH="192" 
         HEIGHT="190" 
         ShowControls="1" 
         ShowStatusBar="0" 
         ShowDisplay="0" 
         autostart="0"> 
</EMBED> 

我试图如何添加 “SRC” 动态和启动/停止播放

document.getElementById("player").src = "http://localhost/abc/test.wmv"; 

它不工作

我应该怎么办?

+1

我强烈建议移动到HTML 5'

回答

0

你应该能够与setAttribute方法是这样做到这一点...

document.getElementById("player").setAttribute("src", "http://localhost/abc/test.wmv"); 
+0

当我从萤火虫检查它属性是精心设置的。但它没有演奏。即使播放按钮不起作用 – dinesh707

+0

什么巨魔做了所有这些投票??? – musefan

+0

不知道投票 – dinesh707

0

jQuery的应该是

$('#player').attr('src','http://localhost/abc/test.wmv'); 
纯JS

我认为

document.getElementById('player').setAttribute('src', 'http://localhost/abc/test.wmv');