当前位置:首页 > JavaScript

Window width and height

canca16年前 (2010-12-17)JavaScript681
<body>
<script type="text/javascript">
//如果使用DTD申明,请注意document.documentElement与document.body的兼容处理 - dh20156
var s="";
s+="\r\n网页整体区域宽:"+document.body.clientWidth;
s+="\r\n网页可见区域高:"+document.documentElement.clientHeight;//window.innerWidth -firefox;
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;
alert(s);
</script>
</body>

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/269.html

标签: JavaScript
分享给朋友:

“Window width and height” 的相关文章

javascript IE与FireFox 一些兼容写法

1>获取控件用document.getElementById,不用document.all(FF等浏览器不支持)2><button> 会被firefox解释为提交form或者刷新页面,需要写标准<button type="button">3>使用childN…

javascript 弹出式窗体详解

1>window.prompt(text, value) 簡單的基與模態窗體的對話框,(返回你輸入)   var v=window.prompt("提示","請輸入你的名字")2>window.confirm(text,mess)  模態確認框(返回"是/否…

event事件兼容mozilla firefox的问题

本来一个写好了的脚本在IE下正常,可是在mozilla firefox中我们发现程序报类似如下的错误: event is not defined obj has no properties 原因是Firefox中使用了不同的事件对象模型,不同于IE Dom,用的是W3C Dom. 下是我在网上找到的…

JavaScript对粘贴板的全操作

<html>    <head>        <script language="javascript">function copy_clip(copyObjectName…

一个跨浏览器通用的JS广告轮显(通用的哦.)

项目需要,无耐做了个通用的。当然无法与CSDN的那个比美。但我这个是通用的。不用写两句JS代码就可以实显广告轮显。 //------------------------------------------------------------ //CopyRight(C)CAnca Software…

常用javascirpt脚本

1.让文字不停地滚动 <MARQUEE>滚动文字</MARQUEE> 2.记录并显示网页的最后修改时间 <script language=javascript> document.write("最后更新时间: " + document.lastModified + "")…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。