以编程方式更改嵌入播放器Not Working上的src属性
Programmatically change the src attribute on embed player Not Working
我正试图更改src属性以在javascript中播放youtube视频,但似乎无法正常工作。
以下是我一直试图使用的声明:
$("#youtube-player").setAttribute('src', obj[i].SongURL);
这是HTML:
<div id="youtube-player">
<embed id="player" width="420" height="345"
type="application/x-shockwave-flash" />
</div>
obj[i]具有正确的数据FYI
您正在设置div的src属性,而不是嵌入标记,请尝试以下操作。
$("#youtube-player > embed").attr('src', obj[i].SongURL);
或者最好像@LOL上面建议的那样选择#player
:p
演示宽度视频标签
问题是您在错误的id
中更改src
$("#player").attr('src', obj[i].SongURL);
相关文章:
- $rootScope not working
- jQuery document.ready not working
- Javascript getElementsByTagName not working?
- JQuery.val( ) not working
- Tomcat websocket is not working
- Javascript JSON.parse not working
- NodeJS Multer is not working
- Regex not working
- Ember run.debounce not working
- AngularJs 1 not working
- document.getElementById.style.backgroundImage not working
- Rxjs5, distinct() is not working
- createOscillator noteOn not working
- Javascript - .getHours() not working
- Javascript setTimeout not working | onkeydown
- MongoDB $pull not working
- Express router.use not working
- JSONP not working
- window.opener not working in chrome & IE
- Backbone + RequireJS: Collection.each() is not working