<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
/**{ padding: 0; margin: 0;}*/
body{ height: 1500px; border:3px solid #fbcb09; padding: 5px;}
.oBox{ width: 1000px; height: 1000px;}
#div1{ position: fixed;bottom: 0; border: 1px solid #ffe87c; }
</style>
<script>
window.onload = function(){
var a = getInfo();
var arr = a.split(" ");
var oDiv= document.getElementById('div1');
var oUl = oDiv.getElementsByTagName('ul')[0];
for(var i =0; i < arr.length;i++){
var oLi = document.createElement('li');
oLi.innerHTML = arr[i];
oUl.appendChild(oLi);
}
} function getInfo(){
str = "";
str += "网页可见区域宽度:" + document.documentElement.clientWidth +"px,(包括padding、border、margin) ";
str += "网页可见区域高度:" + document.documentElement.clientHeight +"px,(包括padding、border、margin) ";
str += "网页body宽度:" + document.body.clientWidth +"px,(只包括padding) ";
str += "网页body高度:" + document.body.clientHeight +"px,(只包括padding) ";
str += "网页body区域宽度:" + document.body.offsetWidth +"px,(只包括padding,border) ";
str += "网页body区域高度:" + document.body.offsetHeight +"px,(只包括padding,border) ";
str += "网页滚动上去的高度(chrome+ie+opera):" + document.body.scrollTop +"px ";
str += "网页滚动上去的高度(ff):" + document.documentElement.scrollTop +"px ";
str += "网页滚动到左侧的宽度(chrome+ie+opera):" + document.body.scrollLeft +"px ";
str += "网页滚动到左侧的宽度(ff):" + document.documentElement.scrollLeft +"px ";
str += "网页内容宽度:" + document.body.scrollWidth +"px,(只包括padding,border) ";
str += "网页内容高度:" + document.body.scrollHeight +"px,(只包括padding,border) ";
str += "网页正文顶部位置:" + window.screenTop +"px(窗口距屏幕顶部的高度,非全屏时改变) ";
str += "网页正文左侧位置:" + window.screenLeft +"px(窗口距屏幕左侧的宽度,非全屏时改变) ";
str += "屏幕分辨率的宽:" + window.screen.width +"px ";
str += "屏幕分辨率的高:" + window.screen.height +"px ";
str += "屏幕可用工作区宽度:" + window.screen.availWidth +"px ";
str += "屏幕可用工作区高度:" + window.screen.availHeight + "(屏幕分辨率高度减去了任务栏高度) " ;
str += "屏幕设置的色彩:" + window.screen.colorDepth + "位彩色" +" ";
str += "屏幕设置是:" + window.screen.deviceXDPI + "像素/英寸";
return str;
}
</script>
</head>
<body>
<div class="oBox"></div>
<div class="oBox"></div>
<div id="div1">
<ul></ul>
</div>
</body>
</html>

  

document.body / document.ducumentElement /等获取高度和宽度的区别 ----转载的更多相关文章

  1. document.body / document.ducumentElement /等获取高度和宽度的区别

    document.body / document.ducumentElement /等获取高度和宽度的区别 <!DOCTYPE html> <html> <head la ...

  2. js获取高度和宽度

      CreateTime--2017年7月24日10:15:47Author:Marydon js获取高度和宽度 参考连接:http://www.cnblogs.com/EasonJim/p/6229 ...

  3. js 获取浏览器高度和宽度值(多浏览器)(转)

    IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...

  4. JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,offsetY,innerHeight)

    IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...

  5. JavaScript获取浏览器高度和宽度值

    IE中:  document.body.clientWidth ==> *DY对象宽度 document.body.clientHeight ==> *DY对象高度 document.do ...

  6. 转:JS获取浏览器高度和宽度

    发现一篇好文章,汇总到自己的网站上. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> ...

  7. js 获取浏览器高度和宽度值(多浏览器)

    IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...

  8. 不同浏览器JS获取浏览器高度和宽度

    摘自:http://blog.csdn.net/lai_gb/archive/2009/07/04/4320956.aspx IE中: document.body.clientWidth ==> ...

  9. js获取浏览器高度和宽度值,尽量的考虑了多浏览器。

    js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ...

随机推荐

  1. hibernate xx(tableName) is not mapped

    数据库中表名是:book,数据库表名不区分大小写的 之后我在hibernate 使用book, String sql="from book"; Query query=sessio ...

  2. Java for LeetCode 228 Summary Ranges

    Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...

  3. nyoj412_bitset_

    Same binary weight 时间限制:300 ms  |  内存限制:65535 KB 难度:3   描述 The binary weight of a positive  integer ...

  4. 数据结构顺序表删除所有特定元素x

    顺序表类定义: template<class T> class SeqList : { public: SeqList(int mSize); ~SeqList() { delete[] ...

  5. C# 操作IIS方法集合

    如果在win8,win7情况下报错:未知错误(0x80005000) 见http://blog.csdn.net/ts1030746080/article/details/8741399 using ...

  6. C#中DataTable排序、检索、合并等操作实例

    转载引用至:http://www.jb51.net/article/49222.htm     一.排序1.获取DataTable的默认视图2.对视图设置排序表达式3.用排序后的视图导出的新DataT ...

  7. 51nod 1099 任务执行顺序 (贪心算法)

    题目:传送门. 题意:中文题. 题解:r[i]-o[i]值大的先进行.反证法:如果大的后进行,会导致空间增大,所以一定大的是先进行. #include <iostream> #includ ...

  8. IOS - 多态

    1. 多态性 多态性是个生物名词,用来表示生物体在生命周期中的不同形态,用在编程语言中则表示相同的方法名,但是却有不同的实现方式.或者说相同的名字,不同的类.我们来看一个书上的示例: #import  ...

  9. 9.27js拓展、bootstrap菜鸟教程

    js(点击挂上 与 点击移除) <div id="dd" style="width:200px; height:200px; background-color:#6 ...

  10. jquery this 与javascript的this

    <div class="list"> <table> <thead> <tr> <th width="110&quo ...