zoukankan      html  css  js  c++  java
  • Js获取标签高度

     能力有限:问个问题,标签相对页面高度,是怎么写?

    1. 鼠标的横坐标,X轴:  event.clientX;
    2. 鼠标的竖坐标,Y轴:  event.clientY;
    3. 网页可见区域宽:      document.body.clientWidth;
    4. 网页可见区域高:          document.body.clientHeight;
    5. 网页可见区域高(包括边线的宽): document.body.offsetHeight;
    6. 网页正文全文宽:      document.body.scrollWidth;
    7. 网页正文全文高:      document.body.scrollHeight;
    8. 网页被卷去的左:    document.body.scrollLeft;  
    9. 网页正文部分上:      window.screenTop;
    10. 网页正文部分左:      window.screenLeft;
    11. 屏幕分辨率的高:      window.screen.height;
    12. 屏幕分辨率的宽:    window.screen.width;
    13. 屏幕可用工作区高度:    window.screen.availHeight;
    14. 屏幕可用工作区宽度:    window.screen.availWidth;
    15. 标签内部高度:        divHg.clientHeight;     divHg为对象: var divHg = document.getElementById("xxxxx");
    16. 标签内部高度:        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 += " 鼠标的竖坐标,y轴:"+ event.clientY;
    s += " 网页可见区域宽 :"+ document.body.clientWidth;
    s += " 网页可见区域高:"+ document.body.clientHeight;
    s += " 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
    s += " 网页正文全文宽:"+ document.body.scrollWidth;
    s += " 网页正文全文高:"+ document.body.scrollHeight;
    s += " 网页被卷去的高:"+ document.body.scrollTop;
    s += " 网页被卷去的左:"+ document.body.scrollLeft;
    s += " 网页正文部分上:"+ window.screenTop;
    s += " 网页正文部分左:"+ window.screenLeft;
    s += " 屏幕分辨率的高:"+ window.screen.height;
    s += " 屏幕分辨率的宽:"+ window.screen.width;
    s += " 屏幕可用工作区高度:"+ window.screen.availHeight;
    s += " 屏幕可用工作区宽度:"+ window.screen.availWidth;
    s += " 标签内部高度:"+ divHg.clientHeight;
    s += " 标签内部宽度:"+ divWd.clientWidth;
    alert(s);

  • 相关阅读:
    Digital Square(hdu4394)搜索
    Substrings(hdu1238)字符串匹配
    Graveyard(poj3154)
    数据库的范式理论
    模和除
    You can Solve a Geometry Problem too (hdu1086)几何,判断两线段相交
    对vector等STL标准容器进行排序操作(转!)
    0 or 1(hdu2608)数学题
    LintCode 4.丑数
    LintCode 9.Fizz Buzz问题
  • 原文地址:https://www.cnblogs.com/lbjz/p/3495110.html
Copyright © 2011-2022 走看看