Object height 属性
定义和用法
height
属性设置或返回 <object> 元素的 height 属性 的值。
height 属性规定对象的高度,以像素计。
提示:请使用 width 属性 设置或返回 <object> 元素的 width 属性 的值。
另请参阅:
HTML 参考手册:HTML <object> height attribute
HTML 参考手册:HTML <object> tag
实例
例子 1
将 <object> 元素的高度更改为 400px:
document.getElementById("myObject").height = "400";
例子 2
获取 <object> 元素的高度:
var x = document.getElementById("myObject").height;
例子 3
将 <object> 元素的高度和宽度更改为 300px:
document.getElementById("myObject").height = "500"; document.getElementById("myObject").width = "500";
语法
返回 height 属性:
objObject.height
设置 height 属性:
objObject.height = pixels
属性值
Value | Description |
---|---|
pixels | Specifies the height of the object, in pixels (for example, height="100"). |
Technical details
Return value: | A number, representing the height of the object, in pixels. |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |