javascript得到浏览的可用高度
2015-09-26 16:34
627 查看
1.第一个页面 max1
2.第一个页面 max2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MaxHeight setting </title> <script type="text/javascript"> function screenInfo(){ var s = ""; s += "\r\n网页可见区域宽:"+ document.body.clientWidth; s += "\r\n网页可见区域高:"+ document.body.clientHeight; s += "\r\n网页可见区域宽:"+ document.body.offsetWidth +" (包括边线的宽)"; s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"; s += "\r\n网页正文全文宽:"+ document.body.scrollWidth; s += "\r\n网页正文全文高:"+ document.body.scrollHeight; s += "\r\n网页被卷去的高:"+ document.body.scrollTop; s += "\r\n网页被卷去的左:"+ document.body.scrollLeft; s += "\r\n网页正文部分上:"+ window.screenTop; s += "\r\n网页正文部分左:"+ window.screenLeft; s += "\r\n屏幕分辨率的高:"+ window.screen.height; s += "\r\n屏幕分辨率的宽:"+ window.screen.width; s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight; s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth; s+="\r\n 网页的可见高度:"+top.document.documentElement.clientHeight; s+="\r\n 网页的可见宽度:"+top.document.documentElement.clientWidth; alert(s); } </script> </head> <body> <input type="button" onclick="screenInfo()" value='计算屏幕参数'/> <iframe style="background:#33FF33;width:400px;height:400px;" > </iframe> </body> </html>
2.第一个页面 max2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MaxHeight setting </title> <script type="text/javascript"> function screenInfo(){ var s = ""; s += "\r\n网页可见区域宽:"+ document.body.clientWidth; s += "\r\n网页可见区域高:"+ document.body.clientHeight; s += "\r\n网页可见区域宽:"+ document.body.offsetWidth +" (包括边线的宽)"; s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"; s += "\r\n网页正文全文宽:"+ document.body.scrollWidth; s += "\r\n网页正文全文高:"+ document.body.scrollHeight; s += "\r\n网页被卷去的高:"+ document.body.scrollTop; s += "\r\n网页被卷去的左:"+ document.body.scrollLeft; s += "\r\n网页正文部分上:"+ window.screenTop; s += "\r\n网页正文部分左:"+ window.screenLeft; s += "\r\n屏幕分辨率的高:"+ window.screen.height; s += "\r\n屏幕分辨率的宽:"+ window.screen.width; s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight; s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth; <span style="font-size:14px;color:#ff6666;"> <strong> s+="\r\n 网页的可见高度:"+top.document.documentElement.clientHeight; s+="\r\n 网页的可见宽度:"+top.document.documentElement.clientWidth;</strong></span> alert(s); } </script> </head> <body> <input type="button" onclick="screenInfo()" value='计算屏幕参数'/> <iframe style="background:#33FF33;width:400px;height:400px;" > </iframe> </body> </html>
相关文章推荐
- JavaScript高级程序设计之变量、作用域和内存问题之执行环境及作用域第4.2讲敏敏笔记
- javascript自学之路(三)————js对象类型之本地对象
- 深入分析jsonp协议原理
- Ember.js 入门指南——路由重定向
- 浅谈JSON中stringify 函数、toJosn函数和parse函数
- js 为label标签和div标签赋值
- javascript编码规范
- JavaScript高级程序设计之变量、作用域和内存问题之基本类型和引用类型的值第4.1讲笔记
- 应用seajs 做了个向上滚动的demo
- javascript 奇技淫巧45招
- JavaScript高级程序设计之基本概念之函数第3.7讲笔记
- JavaScript高级程序设计之基本概念之语句第3.6讲笔记
- 浅谈JSONP跨域请求
- JSON数据解析
- JavaScript高级程序设计之基本概念之相等操作符第3.5.8讲笔记
- JavaScript高级程序设计之基本概念之相等操作符第3.5.7讲笔记
- JavaScript高级程序设计之基本概念之关系操作符第3.5.6讲笔记
- JavaScript高级程序设计之基本概念之操作符之加性操作符第3.5.5讲笔记
- JavaScript高级程序设计之基本概念之操作符之乘性操作符第3.5.4讲笔记
- JavaScript高级程序设计之基本概念之操作符之布尔操作符第3.5.3讲笔记