在Web API中,有一个DOMRect接口,它的底部有一个属性,它使我们可以看到DOMRect对象的底部。它返回y +高度坐标值,或者如果高度为负,则返回y。
用法:
var recX = DOMRect.bottom;
返回类型:
Double value
范例1:当高度为正时
DOMRect bottom property
GeeksForGeeks
DOMRect bottom property
Get bottom
function getDOMRect() {
var myDOMRect = new DOMRect(0, 0, 100, 100);
var recbottom = myDOMRect.bottom;
document.getElementById(
'DOMRect').innerHTML = recbottom;
}
输出:
在单击按钮之前:
单击按钮后:
范例2:当高度为负数时
DOMRect bottom property
GeeksForGeeks
DOMRect bottom property
Get bottom
function getDOMRect() {
var myDOMRect = new DOMRect(0, 0, 100, -100);
var recbottom = myDOMRect.bottom;
document.getElementById('DOMRect').innerHTML = recbottom;
}
输出:
在单击按钮之前:
单击按钮后:
支持的浏览器:
谷歌浏览器
Safari 10.1
Firefox
Opera