我想控制embed标记中的值,但无法在JavaScript中找到这样做的方法。
来自youtube ...
<div id="watch-player" class="flash-player">
<embed
type="application/x-shockwave-flash"
src="http://s.ytimg.com/yt/swfbin/watch_as3-vflJrftp4.swf"
width="640"
id="movie_player"
height="390"
...
>
</div>
如何在指定的div id中更改embed标签的宽度和高度值?
感谢。
答案 0 :(得分:3)
var embedElem = document.getElementById("movie_player");
embedElem.setAttribute("height", "200");
embedElem.setAttribute("width", "300");
答案 1 :(得分:0)
获得标记后(例如,使用getElementsByTagName('embed')
,或者):
var embed = ... // however you want to get the embed tag
embed.setAttribute("width","1920");
embed.setAttribute("height","1200");
// or whichever attributes to change