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

js中获取宽高的更多相关文章

  1. DOM中获取宽高、位置总结

    原生JS 一.文档.窗口的宽高和位置 // 获取屏幕的宽高 window.screen.height | window.screen.width // 屏幕可用工作区宽高 window.screen. ...

  2. Adatper中获取宽高为0的问题

    但是我们想在getView()中获取ImageView的宽和高存在问题,在getView()里面刚开始显示item的时候利用ImageView.getWidth() 获取的都是0,为什么刚开始获取不到 ...

  3. js中各种宽高

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

  4. JS中的宽高(基础知识很重要)

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

  5. JS浏览器获取宽高

    screen.availHeight is the height the browser's window can have if it is maximized. (including all th ...

  6. 不依赖三方库从图像数据中获取宽高-gif、bmp、png、jepg

    int extract_pic_info(const BYTE *pic, const uint32_t size, int &width, int &height) { ; widt ...

  7. js实现未知宽高的元素在指定元素中垂直水平居中

    js实现未知宽高的元素在指定元素中垂直水平居中:本章节介绍一下如何实现未知宽高的元素在指定元素下实现垂直水平居中效果,下面就以span元素为例子,介绍一下如何实现span元素在div中实现水平垂直居中 ...

  8. js 和 jquery 里面几个获取宽高的调查

    罗列下 js 和 jquery 里面获取宽高的方法: obj.offsetWidth = $obj.outerWidth()  // offsetWidth obj.clientWidth = obj ...

  9. js中获取URL中指定的查询字符串

    js中获取URL中指定的搜索字符串,主要利用location对象实现,废话少说,上代码. function getSearchString(key) { // 获取URL中?之后的字符 var str ...

随机推荐

  1. POJ 3280 Cheapest Palindrome DP题解

    看到Palindrome的题目.首先想到的应该是中心问题,然后从中心出发,思考怎样解决. DP问题通常是从更加小的问题转化到更加大的问题.然后是从地往上 bottom up地计算答案的. 能得出状态转 ...

  2. Android后台服务拍照的解决方式

    一.背景介绍 近期在项目中遇到一个需求.实现一个后台拍照的功能. 一開始在网上寻找解决方式.也尝试了非常多种实现方式,都没有惬意的方案.只是确定了难点:即拍照要先预览,然后再调用拍照方法.问题也随之而 ...

  3. luogu3807 【模板】 卢卡斯定理

    题目大意 对于一个很大的$n,m,p$如何求$C_{n+m}^m\mod p$? Lucas定理 若$n_i,m_i$分别是$n,m$在$p$进制下第$i$位的数字,则有 $$C_n^m\mod p= ...

  4. luogu3376 【模板】 网络最大流

    题目大意 给出一个网络图,以及其源点和汇点,求出其网络最大流. 概念 可以把网络图看作管道,节点看作管道的交界处.流就像是管道里的流水.管道有个容量(相当于横截面积),还会有个流量(相当于水流占了管道 ...

  5. oc14--匿名对象

    // // main.m // 匿名对象 #import <Foundation/Foundation.h> #import "Person.h" #import &q ...

  6. 找新朋友(hdoj--1286--欧拉函数)

    欢迎参加--每周六晚的BestCoder(有米!) 找新朋友 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  7. SpringBoot之表单验证@Valid

    转自:https://www.cnblogs.com/chenlove/p/8708627.html SpringBoot提供了强大的表单验证功能实现,给我们省去了写验证的麻烦: 这里我们给下实例,提 ...

  8. SSH整合报错:找不到元素 'beans' 的声明

    转自:https://blog.csdn.net/haozhugogo/article/details/54233608 spring版本问题,将bean.xml中xsd文件定义的版本改为spring ...

  9. Cracking the Coding Interview 6.2

    There is an 8*8 chess board in which two diagnolly opposite corners have been cut off. You are given ...

  10. C#控制台显示进度条

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Prog ...