Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->  <script type="text/javascript">function getInfo(){
var s = "";
s += " 网页可见区域宽:"+ document.body.clientWidth+"\n";
s += " 网页可见区域高:"+ document.body.clientHeight+"\n";
s += " 网页可见区域宽:"+ document.body.offsetWidth + " (包括边线和滚动条的宽)"+"\n";
s += " 网页可见区域高:"+ document.body.offsetHeight + " (包括边线的宽)"+"\n";
s += " 网页正文全文宽:"+ document.body.scrollWidth+"\n";
s += " 网页正文全文高:"+ document.body.scrollHeight+"\n";
s += " 网页被卷去的高(ff):"+ document.body.scrollTop+"\n";
s += " 网页被卷去的高(ie):"+ document.documentElement.scrollTop+"\n";
s += " 网页被卷去的左:"+ document.body.scrollLeft+"\n";
s += " 网页正文部分上:"+ window.screenTop+"\n";
s += " 网页正文部分左:"+ window.screenLeft+"\n";
s += " 屏幕分辨率的高:"+ window.screen.height+"\n";
s += " 屏幕分辨率的宽:"+ window.screen.width+"\n";
s += " 屏幕可用工作区高度:"+ window.screen.availHeight+"\n";
s += " 屏幕可用工作区宽度:"+ window.screen.availWidth+"\n";
s += " 你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色"+"\n";
s += " 你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸"+"\n";
alert (s);
}
getInfo();
</script>

原文地址:http://www.cnblogs.com/tearer/archive/2010/09/06/1819471.html

jQuery 获取屏幕高度、宽度

alert($(window).height()); //浏览器当前窗口可视区域高度
alert($(document).height()); //浏览器当前窗口文档的高度
alert($(document.body).height());//浏览器当前窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin
alert($(window).width()); //浏览器当前窗口可视区域宽度
alert($(document).width());//浏览器当前窗口文档对象宽度
alert($(document.body).width());//浏览器当前窗口文档body的高度
alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin // 获取页面的高度、宽度
function getPageSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else {
if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
if (document.documentElement.clientWidth) {
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else {
if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else {
if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
}
}
// for small pages with total height less then height of the viewport
if (yScroll < windowHeight) {
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if (xScroll < windowWidth) {
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
return arrayPageSize;
} // 滚动条
document.body.scrollTop;
$(document).scrollTop(); 原文地址:http://hoojo.cnblogs.com/

(转)JS获取当前对象大小以及屏幕分辨率等的更多相关文章

  1. (转)JS获取当前对象大小以及屏幕分辨率等

    原文 JS获取当前对象大小以及屏幕分辨率等   <script type="text/javascript">function getInfo(){       var ...

  2. JS获取当前对象大小以及屏幕分辨率等...

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta nam ...

  3. 【Javascript Demo】JS获取当前对象大小以及屏幕分辨率等

    效果如下: 代码如下: <html> <head> <title>获取当前对象大小以及屏幕分辨率等</title> <body> <d ...

  4. JS获取当前网页大小以及屏幕分辨率等

    网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWid ...

  5. js获取页面宽度高度及屏幕分辨率

    网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWid ...

  6. js 获取 客户区 大小

    js 获取 客户区 大小 本文内容来自<javascript高级程序设计(第二版)> 内容, 只是方便大家以后可能会用到... <script type="text/jav ...

  7. 【全面总结】js获取元素位置大小

    [js获取元素位置+元素大小]全面总结 目录 1.关于offset offsetParent(只读) offsetTop(只读) offsetLeft(只读) offsetHeight(只读) off ...

  8. JS获取元素尺寸大小、鼠标位置

    //e.clientX|Y:表示鼠标相对浏览器可视窗口的当前坐标 //e.offsetX|Y:表示鼠标相对于事件源对象的坐标 //e.pageX|Y:表示鼠标相对于网页的坐标 /* element.o ...

  9. 前端页面js与flash交互——js获取flash对象,并传递参数

    背景介绍: 最近在搞一个项目,涉及到图片选取,裁剪,上传等,由于浏览器安全性问题,js无法获取到<input type="file">中选取的文件路径,而且对照片的裁剪 ...

随机推荐

  1. ruby迭代器iterator和枚举器Enumerator

    编写自定义的迭代器 The defining feature of an iterator method is that it invokes a block of code associatedwi ...

  2. 【HDOJ】2955 Robberies

    01背包.将最大金额作为容量v.概率做乘法. #include <stdio.h> #include <string.h> #define mymax(a, b) (a> ...

  3. Xmanager Enterprise 4 使用说明

    Xmanager Enterprise 4 使用说明 安装Xmanager Enterprise 4操作步骤比较简单,下一步即可完成. Xbrowser 使用xdcmp 协议通过图形化桌面远程连接到l ...

  4. Leetcode 240. Search a 2D Matrix II

    Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...

  5. statspack系列2

    Analysing Statspack 2       命中率陷阱 原文:http://jonathanlewis.wordpress.com/2006/12/27/analysing-statspa ...

  6. CSS六大选择器(注释css表里不能加注释!!)

    @charset "utf-8"; /* CSS Document */ <!--标签控制器--> body{ background-color:#F00} <! ...

  7. 在eclipse中使用jetty插件替代m2e开发调试maven web项目

    第一步在相应的web项目上配置jetty插件,配置如下: <plugin> <groupId>org.mortbay.jetty</groupId> <art ...

  8. BZOJ3210: 花神的浇花集会

    3210: 花神的浇花集会 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 238  Solved: 119[Submit][Status] Descri ...

  9. C# web 网页刷新时数据集的保存和应用

    Web 数据访问策略建议 设计 Web 应用程序中的数据访问时,您要做出多种选择,例如与数据源通信的方式.是否在页的往返过程之间存储数据.以及如果确实要存储数据应存储在何处等.您所做的选择可以确定应用 ...

  10. wifi测试相关(iwconfig,WPA Supplicant用法)

    iwconfig用法 1.打开无线网卡电源 iwconfig wlan0 txpower no 2.列出区域内的无线网络 iwconfig wlan0 scan 3.假设要连接到网络myhome(即e ...