- 浏览: 88678 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
zhaohaolin:
哟,龙哥,你还搞C,好高大上的东西啊
xcode初探 -
robinqu:
又改了一些小错误~
[更新20100922]jQuery Location Select 插件- 地址联动、地理检测 -
robinqu:
kimm 写道这个功能不错,就是应用有点局限,内网就不好用了。 ...
[更新20100922]jQuery Location Select 插件- 地址联动、地理检测 -
robinqu:
更新了⋯⋯把代码重写了一次⋯⋯大家可以实现任何种类的联动,以及 ...
[更新20100922]jQuery Location Select 插件- 地址联动、地理检测 -
robinqu:
truth315 写道不好意思了,compu指的是getAre ...
JavaScript Prototype基础
Window Geometry
窗口几何关系
Screen坐标系是描述浏览器窗口和桌面之间的几何关系的,其坐标是相对于桌面左上角的。
Window坐标系描述了浏览器页面可视区域的几何关系,其坐标是相对于可视区域的左上角。
Document坐标系描述了HTML元素与document文档的几何关系,其坐标是相对于document对象的左上角的。
当document足够长而产生滚动条,document坐标系和window坐标系就会产生差异,两个坐标系之间就要考虑转换的方法。
IE在默认状态下将这些相关属性放在document.body下,但如果有<!DOCTYPE>声明,那么就会放在document.documentElement下。
以下是一个获取几何参数的函数
窗口几何关系
引用
Screen coordinates describe the position of a browser window on the desktop; they are measured relative to the upper-left corner of the desktop.
Screen坐标系是描述浏览器窗口和桌面之间的几何关系的,其坐标是相对于桌面左上角的。
引用
Window coordinates describe a position within the web browser's viewport; they are measured relative to the upper-left corner of the viewport.
Window坐标系描述了浏览器页面可视区域的几何关系,其坐标是相对于可视区域的左上角。
引用
Document coordinates describe a position within an HTML document; they are measured relative to the upper-left corner of the document. When the document is longer or wider than the viewport (as web pages often are), document coordinates and window coordinates are not the same, and you'll need to take the position of the scrollbars into account when converting between these two coordinate systems.
Document坐标系描述了HTML元素与document文档的几何关系,其坐标是相对于document对象的左上角的。
当document足够长而产生滚动条,document坐标系和window坐标系就会产生差异,两个坐标系之间就要考虑转换的方法。
引用
For some reason, IE places these window geometry properties on the <body> of the HTML document. And, further confusing matters, IE 6, when displaying a document with a <!DOCTYPE> declaration, places the properties on the document.documentElement element instead of document.body.
IE在默认状态下将这些相关属性放在document.body下,但如果有<!DOCTYPE>声明,那么就会放在document.documentElement下。
浏览器 | window对象坐标大小 | 可视区域大小 | 滚动条 | document对象坐标大小 |
FF | screenX/Y | innerWidth/Height | pageXOffset/YOffset | documentElement.scrollLeft/Top |
IE with doctype | screenLeft/Top | documentElement.clientWidth | documentElement.scrollLeft/Top/Height | documentElement.scrollLeft/Top |
以下是一个获取几何参数的函数
/** * Geometry.js: portable functions for querying window and document geometry * * This module defines functions for querying window and document geometry. * * getWindowX/Y( ): return the position of the window on the screen * getViewportWidth/Height( ): return the size of the browser viewport area * getDocumentWidth/Height( ): return the size of the document * getHorizontalScroll( ): return the position of the horizontal scrollbar * getVerticalScroll( ): return the position of the vertical scrollbar * * Note that there is no portable way to query the overall size of the * browser window, so there are no getWindowWidth/Height( ) functions. * * IMPORTANT: This module must be included in the <body> of a document * instead of the <head> of the document. */ var Geometry = {}; if (window.screenLeft) { // IE and others Geometry.getWindowX = function( ) { return window.screenLeft; }; Geometry.getWindowY = function( ) { return window.screenTop; }; } else if (window.screenX) { // Firefox and others Geometry.getWindowX = function( ) { return window.screenX; }; Geometry.getWindowY = function( ) { return window.screenY; }; } if (window.innerWidth) { // All browsers but IE Geometry.getViewportWidth = function( ) { return window.innerWidth; }; Geometry.getViewportHeight = function( ) { return window.innerHeight; }; Geometry.getHorizontalScroll = function( ) { return window.pageXOffset; }; Geometry.getVerticalScroll = function( ) { return window.pageYOffset; }; } else if (document.documentElement && document.documentElement.clientWidth) { // These functions are for IE 6 when there is a DOCTYPE Geometry.getViewportWidth = function( ) { return document.documentElement.clientWidth; }; Geometry.getViewportHeight = function( ) { return document.documentElement.clientHeight; }; Geometry.getHorizontalScroll = function( ) { return document.documentElement.scrollLeft; }; Geometry.getVerticalScroll = function( ) { return document.documentElement.scrollTop; }; } else if (document.body.clientWidth) { // These are for IE4, IE5, and IE6 without a DOCTYPE Geometry.getViewportWidth = function( ) { return document.body.clientWidth; }; Geometry.getViewportHeight = function( ) { return document.body.clientHeight; }; Geometry.getHorizontalScroll = function( ) { return document.body.scrollLeft; }; Geometry.getVerticalScroll = function( ) { return document.body.scrollTop; }; } // These functions return the size of the document. They are not window // related, but they are useful to have here anyway. if (document.documentElement && document.documentElemnet.scrollWidth) { Geometry.getDocumentWidth = function( ) { return document.documentElement.scrollWidth; }; Geometry.getDocumentHeight = function( ) { return document.documentElement.scrollHeight; }; } else if (document.body.scrollWidth) { Geometry.getDocumentWidth = function( ) { return document.body.scrollWidth; }; Geometry.getDocumentHeight = function( ) { return document.body.scrollHeight; }; }
发表评论
-
WebApp在移动端的涅盘- 另类的移动端应用程序开发
2010-09-27 22:35 4481同时欢迎到我的BLOG讨 ... -
ScriptDoc的Notation规则
2010-01-23 19:37 1759这个还是蛮重要的,以前就一直很羡慕Java有一套标准来着: 转 ... -
关于google.setOnLoadCallback()的一点研究
2010-01-12 10:01 6118google.setOnLoadCallback()是goog ... -
ECMA 推出 JavaScript 5
2009-12-28 21:17 1613转发自http://www.comsharp.co ... -
Javascript 事件编程 (二)
2009-09-18 21:28 1600Event Handlers and the this Key ... -
Javascript 事件编程 (一)
2009-09-04 15:27 1236Events and Event Handling 事件和事件 ... -
Javascript CSS编程 (一)元素定位、透明、内联样式
2009-09-03 14:29 2047Querying Element Position and S ... -
Javascript CSS编程 (二)Computed Styles、Class修改、操作样式表
2009-09-03 13:15 5308Scripting Computed Styles 计算样式 ... -
Javascript DHTML动画
2009-09-03 13:00 1201JS实现的动画效果多半 ... -
Javascript IE4 DOM
2009-09-02 17:14 997很多IE独有的DOM特性是沿袭自IE4的,所以有必要看看IE4 ... -
Javascript 操控选择文本
2009-09-02 17:02 1242Querying Selected Text 查询选择的文本 ... -
Javascript 寻找文档元素
2009-09-02 16:51 2288Finding Elements in a Document ... -
JavaScript window下面的常用函数、属性
2009-09-02 10:30 1139我们常用的一些函数都是全局对象window下面的。这里将其梳理 ... -
JavaScript 在浏览器中的相关概念:执行环境、引入脚本、安全策略等
2009-09-02 09:32 1358The Window as Global Execution ... -
JavaScript Namespace模拟
2009-07-15 18:53 1542做JavaScript的大型项目比较痛苦,它没有namespa ... -
JavaScript Class模拟深入 - Duck Typing 和 Class相关的工具类
2009-07-15 17:16 1759Duck Typing 引用If it implements ... -
JavaScript 判定对象类型
2009-07-15 16:53 1345判定JS的对象类型基本 ... -
JavaScript Class模拟深入 - 继承、子类
2009-07-15 16:27 1696Superclasses and Subclasses ... -
javascript this 关键字小提示
2009-07-14 22:01 1160来自:http://www.macji.com/2009/01 ... -
JavaScript Class模拟基础
2009-07-14 16:39 1103Simulating Classes in JavaScrip ...
相关推荐
10) 每个类都有一个原型(prototype)对象,它具有一套属性和方法,用来共享一个类的方法和常量,还有一个constructor的属性引用构造函数。 11) JavaScript中面向对象的特性: a) 实例属性:在构造函数创建或初始化...
8.7 函数属性、方法和构造函数 8.8 函数式编程 第9章 类和模块 9.1 类和原型 9.2 类和构造函数 9.3 JavaScript中Java式的类继承 9.4 类的扩充 9.5 类和类型 9.6 JavaScript中的面向对象技术 9.7 子类 9.8 ECMAScript...
8.7 函数属性、方法和构造函数 8.8 函数式编程 第9章 类和模块 9.1 类和原型 9.2 类和构造函数 9.3 JavaScript中Java式的类继承 9.4 类的扩充 9.5 类和类型 9.6 JavaScript中的面向对象技术 9.7 子类 9.8 ...
8.7 函数属性、方法和构造函数188 8.8 函数式编程194 第9章 类和模块201 9.1 类和原型202 9.2 类和构造函数203 9.3 JavaScript中Java式的类继承207 9.4 类的扩充210 9.5 类和类型212 9.6 ...
8.7 函数属性、方法和构造函数 8.8 函数式编程 第9章 类和模块 9.1 类和原型 9.2 类和构造函数 9.3 JavaScript中Java式的类继承 9.4 类的扩充 9.5 类和类型 9.6 JavaScript中的面向对象技术 9.7 子类 9.8 ECMAScript...
8.7 函数属性、方法和构造函数188 8.8 函数式编程194 第9章 类和模块201 9.1 类和原型202 9.2 类和构造函数203 9.3 JavaScript中Java式的类继承207 9.4 类的扩充210 9.5 类和类型212 9.6 ...
8.7 函数属性、方法和构造函数 188 8.8 函数式编程 194 第9章 类和模块 201 9.1 类和原型 202 9.2 类和构造函数 203 9.3 javascript中java式的类继承 207 9.4 类的扩充 210 9.5 类和类型 212 9.6 javascript中的面向...
8.7 函数属性、方法和构造函数 8.8 函数式编程 第9章 类和模块 9.1 类和原型 9.2 类和构造函数 9.3 JavaScript中Java式的类继承 9.4 类的扩充 9.5 类和类型 9.6 JavaScript中的面向对象技术 9.7 子类 9.8 ECMAScript...
8.7 函数属性、方法和构造函数 188 8.8 函数式编程 194 第9章 类和模块 201 9.1 类和原型 202 9.2 类和构造函数 203 9.3 javascript中java式的类继承 207 9.4 类的扩充 210 9.5 类和类型 212 9.6 javascript中的面向...
8.7 函数属性、方法和构造函数 188 8.8 函数式编程 194 第9章 类和模块 201 9.1 类和原型 202 9.2 类和构造函数 203 9.3 javascript中java式的类继承 207 9.4 类的扩充 210 9.5 类和类型 212 9.6 javascript中的面向...
2.2.2ArcGIS API for JavaScript与Dojo的关系 2.3开发与调试工具 2.3.1集成开发环境 2.3.2调试工具 2.3.3Firebug 2.3.4其他工具软件 2.4Dojo基础知识 2.4.1JavaScript对象 2.4.2函数也是对象 2.4.3模拟类与继承 ...
4.2.2自定义切片地图图层——百度地图 4.2.3自定义图层——三维建筑图 4.3地图操作 4.3.1地图窗口操作 4.3.2地图属性获取 4.3.3事件处理 4.4地图参数的基本配置 4.4.1漫游与缩放动画的参数配置 4.4.2比例滚动条的...
外部API示例:在ActionScript和Web浏览器中的JavaScript之间进行通信 第章:AIR中的XML签名验证 XML签名验证的基础知识 关于XML签名 实现IURIDereferencer接口 第章:客户端系统环境 客户端系统环境基础知识 使用...
较深入地分析了Qt对象模型的一些基本知识,涉及信号和槽机制、Qt元对象系统、属性系统和对象树机制,以及部件类型和部件的几何布局等内容。 35 \ 第4章 程序主窗口—— QMainWindow 卢传富 Qt应用程序的主窗口是由多...
较深入地分析了Qt对象模型的一些基本知识,涉及信号和槽机制、Qt元对象系统、属性系统和对象树机制,以及部件类型和部件的几何布局等内容。 35 \ 第4章 程序主窗口—— QMainWindow 卢传富 Qt应用程序的主窗口是由...
实例179 修改表单属性为弹出窗口 216 实例180 表单输入单元的文字设置 217 实例181 表单输入单元单击删除 218 实例182 表单文本输入的移动选择 219 实例183 通过下拉列表选择头像 220 3.5 CSS+DIV页面布局 222 实例...
实例179 修改表单属性为弹出窗口 216 实例180 表单输入单元的文字设置 217 实例181 表单输入单元单击删除 218 实例182 表单文本输入的移动选择 219 实例183 通过下拉列表选择头像 220 3.5 CSS+DIV页面布局 222 实例...