js中获取宽高
<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中获取宽高的更多相关文章
- DOM中获取宽高、位置总结
原生JS 一.文档.窗口的宽高和位置 // 获取屏幕的宽高 window.screen.height | window.screen.width // 屏幕可用工作区宽高 window.screen. ...
- Adatper中获取宽高为0的问题
但是我们想在getView()中获取ImageView的宽和高存在问题,在getView()里面刚开始显示item的时候利用ImageView.getWidth() 获取的都是0,为什么刚开始获取不到 ...
- js中各种宽高
各种宽高 Javascript: IE中:document.body.clientWidth ==> BODY对象宽度document.body.clientHeight ==> BODY ...
- JS中的宽高(基础知识很重要)
IE中:document.body.clientWidth ==> BODY对象宽度document.body.clientHeight ==> BODY对象高度document.docu ...
- JS浏览器获取宽高
screen.availHeight is the height the browser's window can have if it is maximized. (including all th ...
- 不依赖三方库从图像数据中获取宽高-gif、bmp、png、jepg
int extract_pic_info(const BYTE *pic, const uint32_t size, int &width, int &height) { ; widt ...
- js实现未知宽高的元素在指定元素中垂直水平居中
js实现未知宽高的元素在指定元素中垂直水平居中:本章节介绍一下如何实现未知宽高的元素在指定元素下实现垂直水平居中效果,下面就以span元素为例子,介绍一下如何实现span元素在div中实现水平垂直居中 ...
- js 和 jquery 里面几个获取宽高的调查
罗列下 js 和 jquery 里面获取宽高的方法: obj.offsetWidth = $obj.outerWidth() // offsetWidth obj.clientWidth = obj ...
- js中获取URL中指定的查询字符串
js中获取URL中指定的搜索字符串,主要利用location对象实现,废话少说,上代码. function getSearchString(key) { // 获取URL中?之后的字符 var str ...
随机推荐
- QQ好友列表数据模型封装
QQ好友中的信息较多.假设我们单独从plist 中直接取出数据 是能够解决这个问题 可是相当复杂.以为列表中分组 .每组中还有不同信息 大致模型是 数组套数组 数组套字典 所以我们要封装数据模型 / ...
- HDU 5291(Candy Distribution-差值dp)
Candy Distribution Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Other ...
- python使用pytest+pytest报告
需要安装pytest和pytest-html pip3 install -U pytest pip3 install -U pytest-html
- Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead的解决的方法
今天在eclipse里报这个错误: Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead. Plea ...
- android app 架构设计01
1:本文有摘抄, 1 2 3 4 5 - 开发过程中.需求.设计.编码的一致性 - 整个程序具有统一的风格,比方对话框样式,button风格,色调等UI元素 - 整个程序详细统一的结构,比方不同模块訪 ...
- spring注入对象类型的属性
一.1.创建service类和Dao类 (1)在service中得到dao对象 2.具体实现过程 (1)在service里边把dao作为类型属性 (2)生成dao类型属性的set方法 public c ...
- Don't Block on Async Code
http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html This is a problem that is brough ...
- php执行运算符
php执行运算符 简介 php 支持一个执行运算符:反引号(``).反引号(``)位于键盘Tab键左上方.php 将尝试将反引号中的内容作为外壳命令来执行,并将其输出信息返回(例如,可以赋给一个变量而 ...
- poj1028--动态规划--Ignatius and the Princess III
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- Super超级ERP系统---(3)基础信息管理--商品管理
商品管理主要包括商品的添加,修改,维护商品所在分类,单位,供应商,品牌,名称,价格,尺寸,规格等属性的维护. 1.商品添加 2.商品列表展示 商品列表界面左侧商品分类,右侧是商品信息