我有一个嵌入标签。
<embed id="embed1" src="test.mp4" width="320" height="260" ></embed>
如何<embed>
使用 JavaScript / jQuery 在加载时更改标签的宽度和高度属性?我知道如何通过以下脚本设置属性值:
$(document).ready(function() {
$('#embed1').attr('width', '320');
});
我可以将宽度设置为 100%,但高度属性的值是多少?
<embed id="embed1" src="test.mp4" width="100%" height="?" ></embed>
我希望我可以省略 height 属性,或者将其设置为 auto 。
注意:鉴于我不能使用 HTML5<video>
标签,因为我必须向后支持旧版浏览器。