Js获取标签高度
能力有限:问个问题,标签相对页面高度,是怎么写?
- 鼠标的横坐标,X轴: event.clientX;
- 鼠标的竖坐标,Y轴: event.clientY;
- 网页可见区域宽: document.body.clientWidth;
- 网页可见区域高: document.body.clientHeight;
- 网页可见区域高(包括边线的宽): document.body.offsetHeight;
- 网页正文全文宽: document.body.scrollWidth;
- 网页正文全文高: document.body.scrollHeight;
- 网页被卷去的左: document.body.scrollLeft;
- 网页正文部分上: window.screenTop;
- 网页正文部分左: window.screenLeft;
- 屏幕分辨率的高: window.screen.height;
- 屏幕分辨率的宽: window.screen.width;
- 屏幕可用工作区高度: window.screen.availHeight;
- 屏幕可用工作区宽度: window.screen.availWidth;
- 标签内部高度: divHg.clientHeight; divHg为对象: var divHg = document.getElementById("xxxxx");
- 标签内部高度: divWd.clientWidth; divWd为对象: var divWd = document.getElementById("xxxxx");
=================================Script使用例子===================================
var divHg = document.getElementById("tit");//标签id
var divWd = document.getElementById("tit");//标签id
var s ="鼠标的横坐标,X轴:"+ event.clientX;
s += "\r\n鼠标的竖坐标,y轴:"+ event.clientY;
s += "\r\n网页可见区域宽 :"+ document.body.clientWidth;
s += "\r\n网页可见区域高:"+ document.body.clientHeight;
s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
s += "\r\n网页正文全文宽:"+ document.body.scrollWidth;
s += "\r\n网页正文全文高:"+ document.body.scrollHeight;
s += "\r\n网页被卷去的高:"+ document.body.scrollTop;
s += "\r\n网页被卷去的左:"+ document.body.scrollLeft;
s += "\r\n网页正文部分上:"+ window.screenTop;
s += "\r\n网页正文部分左:"+ window.screenLeft;
s += "\r\n屏幕分辨率的高:"+ window.screen.height;
s += "\r\n屏幕分辨率的宽:"+ window.screen.width;
s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight;
s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth;
s += "\r\n标签内部高度:"+ divHg.clientHeight;
s += "\r\n标签内部宽度:"+ divWd.clientWidth;
alert(s);