爵哈得 塔布特的窗口属性方法事件网页

修改 Opera 7 窗口位置和尺度
缩放和/或移动窗口

You need to have
Tools/Preferences...Ctrl+F12/Advanced tab/Content category/Javascript Options.../Allow resizing and moving of windows
checkbox checked in order to use this section.





必须大于 300

必须大于 300



坐标线

你能 , 缩放下面的两个 主窗体.

本网页仅在 Opera 7(或更高版本). 系统硬件最低要求: 400Mhz Pentium 2 和 96Mb RAM. 本网页需要占用大量的CPU和内存.

Opera 11.0 or higher

非常感谢华将本网页的基本部分翻译成中文,希望这些网页对中国的网页开发者有所帮助.

屏幕和窗口数据点击固定本视见区上的这个元素

用户屏幕的总宽度 screen.width -

用户屏幕的总高度 screen.height -

对应用程序而言用户屏幕的有效宽度 screen.availWidth -

对应用程序而言用户屏幕的有效高度 screen.availHeight -

浏览器视窗宽度
document.documentElement.offsetWidth
window.innerWidth -当用户调整视窗大小的时候,这个值会动态改变。垂直滚动条(如果有)的宽度包含在内,但不包括 Explorer BarSidebar. Note

浏览器视窗宽度
document.documentElement.offsetHeight
window.innerHeight -当用户调整视窗大小的时候,这个值会动态改变。水平滚动条(如果有)的长度包含在内,但不包括 Tip of the Day bar 的长度. Note

用户浏览器有效宽度 window.outerWidth -

用户浏览器有效高度 window.outerHeight -

高度已确定的浏览器视窗上的文档视图的宽度 document.documentElement.scrollWidth -

宽度已确定的浏览器视窗上的文档视图的高度 document.documentElement.scrollHeight -

用户浏览器窗口的左边到屏幕左边之间的水平距离 window.screenLeft window.screenX -
当缩放浏览器窗口时,本值会改变;目前不支持移动窗口时改变数值;这个值有可能是负数. MSIE 5+ 中计算的是内容区的左边到屏幕左边之间的距离. Note

用户浏览器窗口的顶端到屏幕的顶端之间的垂直距离 window.screenTop window.screenY -
当缩放浏览器窗口时,本值会改变;目前不支持移动窗口时改变数值;这个值有可能是负数. MSIE 5+ 中计算的是内容区的顶端到屏幕顶端左边之间的距离. Note

从左边的绝对位置的最近的父区或左边的布局器算起的水平距离/水平偏移: 以下是相应文档 ScreenData.offsetLeft -

从顶端的绝对位置的最近的父区或顶端的布局器算起的垂直距离/垂直偏移: 以下是相应文档 ScreenData.offsetTop -

鼠标事件坐标 点击固定本视见区上的这个元素
当前鼠标在浏览器内容区(客户区)上的位置的X坐标
Opera 7 Internet Explorer 6 Netscape 6.x ev[en]t.clientX
当前鼠标在浏览器内容区(客户区)上的位置的Y坐标
Opera 7 Internet Explorer 6 Netscape 6.x ev[en]t.clientY
当前鼠标在目标元素上的位置的X坐标
Internet Explorer 6 event.offsetX Note
当前鼠标所在目标元素的类型
当前事件类型
当前鼠标在目标元素上的位置的Y坐标
Internet Explorer 6 event.offsetY Note
鼠标所在的相关的位置确定的元素或最靠近的相关的位置确定的包容元素的X坐标
Opera 7 Internet Explorer 6event.x Note
鼠标所在的相关的位置确定的元素或最靠近的相关的位置确定的包容元素的Y坐标
Internet Explorer 6event.y Note
鼠标在用户屏幕上的位置的X坐标
Opera 7 Internet Explorer 6 Netscape 6.x ev[en]t.screenX
鼠标在用户屏幕上的位置的Y坐标
Opera 7 Internet Explorer 6 Netscape 6.x ev[en]t.screenY
鼠标在具有全部宽度的文档上的位置的X坐标
Opera 7 Netscape 6.x evt.pageX
鼠标在具有全部宽度的文档上的位置的Y坐标
Opera 7 Netscape 6.x evt.pageY
元素的左边缘到它在浏览器窗口上的最左边可见部分之间的距离
Internet Explorer 6 only document.documentElement.scrollLeft
Opera 7 Netscape 6.x window.pageXOffset
元素的顶端边缘到它在浏览器窗口上的最顶端可见部分之间的距离
Internet Explorer 6 onlydocument.documentElement.scrollTop
Opera 7 Netscape 6.xwindow.pageYOffset

Notes about MSIE 6 and NS 6+

Expressions, terms used in reference sites

References used

Peter-Paul Koch's Properties and manipulation (via methods) of the Window object page
MasterGrid for MSIE 4 and 5 (operating systems Windows and MacIntosh), Netscape 4 and 6
http://www.quirksmode.org/viewport/compatibility.html

Web Developper Virtual Library's Grand Unified Table: events and supported properties of the event object
for Netscape 4 and MSIE 4 and 5
http://www.wdvl.com/Authoring/JavaScript/Events/table4.html

MSDN's interactive demo on measurement, dimension and location (in compatible mode only; not in standard-compliant mode)
http://msdn.microsoft.com/workshop/samples/author/css/overview/interactivemeasurement.htm

MSDN's interactive demo on measurement, object's event, scroll positions, client area (in compatible mode only; not in standard-compliant mode)
http://msdn.microsoft.com/workshop/samples/author/dhtml/overview/measure.htm

MSDN's reference on object measurement and location, scroll position, DHTML positioning properties (in compatible mode only; not in standard-compliant mode)
http://msdn2.microsoft.com/en-us/library/ms533024.aspx

Major incompatibilities between MSIE 5+ and Netscape 6+

There is a major incompatibility between MSIE 5+ window.screenTop and NS 6+ window.screenY. MSIE 5+ calculates the distance from the top of the content area (client area) to the top side of the screen. NS 6+ calculates the distance from the top of the browser's window to the top side of the screen. There seems to be no way to figure out the height of chrome elements (menu bar, tools bar, address bar, links bar) present in the browser for MSIE 5+.

The same phenomenon is observed for MSIE 5+ window.screenLeft and NS 6+ window.screenX. MSIE 5+ calculates the distance from the left of the content area (client area) to the left side of the screen. NS 6+ calculates the distance from the left of the browser's window to the left side of the screen. When the MSIE 5+ Explorer Bar is displayed, we can clearly see that the window.screenLeft value is increased while when the NS 6+ Sidebar is displayed, the window.screenX value does not increase since the referenced coordinates system is different. The same phenomenon is observed for chrome bars at the top of the browser's application.

NS 6+ evt.layerX/Y properties calculate the distance from the left/top corner of an element if it is absolutely or relatively positioned; if it's not positioned, then the values are the distance from the left/top of its closest absolutely or relatively positioned containing element. In case the target element has no positioned element within the containment hierarchy, then the body element is the positioned containing element.
There appears to be 3 exceptions to this: input type="text", textarea and options in a select. When an event occurs in one of these 3 elements, regardless if they are positioned or not, the evt.layerX/Y properties will return the offset coordinates within them.
Here's an interactive demo on evt.layerX/Y property values.

MSIE 5+ event.offsetX/Y properties calculate the distance from the left/top corner of the target element (e.g. clicking inside an image) regardless if the element is absolutely or relatively positioned or if its containment element is positioned or not. There appears to be 4 exceptions to this: for A, H, P and SPAN elements, the event.offsetX/Y will return coordinates relative to the offsetParent (which is usually - not always - the closest positioned containing element), otherwise to the BODY element.

So NS 6+ evt.layerX/Y properties are not the equivalent of MSIE 5+ event.offsetX/Y properties.

Known bugs and expected fixes for Mozilla

Bugzilla Bug #114649; Target: Future
Onresize events should fire while resizing the window, not just when the mouse stops moving.

Valid HTML 4.01! CSS compliant Web standards project

© Gérard Talbot  |   Site map