除IE外的浏览器查看窗口大小和位置信息:
//The overall size of the browser window on the desktop var windowWidth = window.outerwidth;
var windowHeight = window.outerHeight; //This is the position of the browser window on the desktop
var windowX = window.screenX;
var windowY = window.screenY; //The size of the viewport in which the HTML document is displayed
//This is the window size minus the menu bars,toolbars,scrollbars,etc.
var viewportWidth = windows.innerWidth;
var viewportHeight = windows.innerHeight; //These values specify the horizontal and vertical scrollbar positions.
//They are used to convert between document coordinates and window coordinates.
//These values specify what part of the document appears in the upper-left corner of the screen.
var horizontalScroll = window.pageXOffset;
var verticalScroll = window.pageYOffset;
------------------------------------------------------------------
var x=window.screenLeft?window.screenLeft: window.screenX ;
var y=window.screenTop?window.screenTop: window.screenY;
alert(x+" "+y);
网页可见区域宽:document.body.clientWidth
网页可见区域高:document.body.clientHeight
网页可见区域宽:document.body.offsetWidth (包括边线的宽)
网页可见区域高:document.body.offsetHeight (包括边线的宽)
网页正文全文宽:document.body.scrollWidth
网页正文全文高:document.body.scrollHeight
网页被卷去的高:document.body.scrollTop
网页被卷去的左:document.body.scrollLeft
网页正文部分上:window.screenTop
网页正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth HTML精确定位: scrollLeft,scrollWidth,clientWidth,offsetWidth
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置
offsetTop:获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置
event.clientX 相对文档的水平座标
event.clientY 相对文档的垂直座标
event.offsetX 相对容器的水平坐标
event.offsetY 相对容器的垂直坐标
document.documentElement.scrollTop 垂直方向滚动的值
event.clientX+document.documentElement.scrollTop 相对文档的水平座标+垂直方向滚动的量 IE,FireFox 差异如下: IE6.、FF1.+: clientWidth = width + padding clientHeight = height + padding offsetWidth = width + padding + border offsetHeight = height + padding + border IE5./5.5:
clientWidth = width - border clientHeight = height - border offsetWidth = width offsetHeight = height (CSS中的margin属性,与clientWidth、offsetWidth、clientHeight、offsetHeight均无关) function resize(){
var win = Ext.fly('窗体对象组件');//获得要调整的窗体,注意这里先用Ext.fly的方式来获取组件 ,如果不行再换别的,如getCmp,get等
//然后参考 http://www.javaeye.com/topic/155981 这篇博客,来动态设定组件的大小
}
window.onresize = resize; Ext.onReady(function(){
resize();
} Ext.onReady(function(){
formWindow = new Ext.Window({
layout:'fit',
width:,
height:,
resizable:true,
closeAction:'close',
plain: true,
maximizable: true,
// minimizable : true, // 最小化
listeners: {
close:function(w){
//关键部分:关闭窗口前先还原,滚动条才不会消失
w.restore();
},
maximize:function(w){
//关键部分:最大化后需要将窗口重新定位,否则窗口会从最顶端开始最大化
w.setPosition(document.body.scrollLeft-,document.body.scrollTop- );
}
}
});
formWindow.show();
})

js之获取窗口大小和位置信息的更多相关文章

  1. C# 图像处理: 获取当前活动窗口句柄,获取窗口大小及位置

    需调用API函数 需在开头引入命名空间 using System.Runtime.InteropServices; 获取当前窗口句柄:GetForegroundWindow() [DllImport( ...

  2. QT获取窗口大小和位置等信息

    QT窗口尺寸,窗口大小和大小改变引起的事件 QResizeEvent. 来源:http://blog.csdn.net/dbzhang800/article/details/6741344?reloa ...

  3. 获取用户当前位置信息的两种方法——H5、微信

    在之前的 调用百度地图API的总结 中获取当前位置信息我用的是 H5 ,其实微信也提供了获取用户地理位置的方法,现将这两种方法都贴出来,看情况选择使用. 一.H5 获取当前地理位置得到经纬度 // H ...

  4. 淘宝(新浪)API获取IP地址位置信息

    package com.parse; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IO ...

  5. PHP 获取IP地址位置信息「聚合数据API」

    聚合数据 提供了[查询IP所属区域]的服务接口,只需要以 GET 请求的方式向 API 传入 IP地址 和 APPKEY 即可获得查询结果. 这里的难点主要在于如何通过PHP获取客户端IP地址,以及如 ...

  6. 【easyui】--普通js中获取easyui中分页信息(page,pageSize等)

    对于datagrid,获取其分页信息: 方法: var pageopt = $('#list_data').datagrid('getPager').data("pagination&quo ...

  7. 关于tomcat7服务下面js无法获取JSESSIONID的cookie信息

    http://tomcat.apache.org/tomcat-5.5-doc/config/context.html Does anyone know what changed in the con ...

  8. (转)linux如何获取鼠标相对位置信息

    #include <stdio.h> #include <stdlib.h> #include <linux/input.h> #include <fcntl ...

  9. html5获取位置信息,h5获取位置信息

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

随机推荐

  1. Microsoft SQL Server 博客目录

    基础概念篇 SQL Server排序规则 SQL SERVER 统计信息概述(Statistics) SQL SERVER 索引之聚集索引和非聚集索引的描述 Sql Server 索引之唯一索引和筛选 ...

  2. Analysis Services OLAP 概述

    1. 什么是OLAP •定义1 :OLAP(联机分析处理)是针对特定问题的联机数据访问和分析.通过对信息(维数据)的多种可能的观察形式进行快速.稳定一致和交互性的存取,允许管理决策人员对数据进行深入观 ...

  3. PHP json_encode中文乱码解决方法

    相信很多人在使用Ajax与后台php页面进行交互的时候都碰到过中文乱码的问题.JSON作为一种轻量级的数据交换格式,备受亲睐,但是用PHP作为后台交互,容易出现中文乱码的问题.JSON和js一样,对于 ...

  4. myeclipse+tomcat 工程名改名的问题 ——————完美解决方案

    当建好的工程再重命名之后,发布和访问的时候都还是原来的名字,这个问题纠结了我很久,最好找到解决方法,这里分享一下,希望大家不要再受这种困惑.解决方法: 点击工程右键->properties-&g ...

  5. 第十九篇:提高SOUI应用程序渲染性能的三种武器

    SOUI是一套100%开源的基于DirectUI的客户端开发框架. 基于DirectUI设计的UI虽然UI呈现的效果可以很炫,但是相对于传统的win32应用程序中每个控件一个窗口句柄的形式,渲染效率是 ...

  6. [荐]jquery插件开发入门

    http://www.cnblogs.com/Wayou/p/jquery_plugin_tutorial.html $.fn.myPlugin = function() { //在这里面,this指 ...

  7. zTree学习文档和DEOM

    http://tool.oschina.net/apidocs/apidoc?api=ztree3.2%2Fapi%2FAPI_cn.html zTree的API http://www.ztree.m ...

  8. Practical Java (一)关于reference

    Practice 1, 4, 7, 8 1. 参数传递:by value or by reference 变量型别:reference 和 primitive Java中的变量分为两种:referen ...

  9. 【转】备份Kylin的元数据

    http://blog.csdn.net/jiangshouzhuang/article/details/51290239 Kylin组织它所有的元数据(包括cube descriptions and ...

  10. SU Demos-07NMO

    本例还不完善,不足之处,欢迎批评指正 先看readme 第1个脚本,显示速度模型 脚本#2,生成数据 脚本#3,显示合成数据 脚本#4,进行速度分析 脚本#5,动校叠加