JavaScript 获得页面区域大小的代码
网页可见区域宽: 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
JavaScript 获得页面区域大小的代码
getPageSize函数返回一个数组,前两个是整个页面的宽度和高度,后两个是页面窗口的宽度和高度
function getPageSize()
{
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY)
{
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
}
else if (document.body.scrollHeight > document.body.offsetHeight)
{
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else
{
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight)
{
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}
else if (document.documentElement && do
相关文档:
<SCRIPT LANGUAGE="JavaScript">
var strDate1 = "2003-06-17";
var strDate2 = "2004-09-18";
//var strDate1 = "2003-06-17 03:03:40.0";
//var strDate2 = "2004-09-18 12:03:12.0" ......
Java代码
<script language="JavaScript">
function js_show(per_id)
{
window.open('/weihu/person/viewResume.jsp?perID='+per_id, 'resume', 'resizable=yes,menuBar=0,toolBar=0,scrollbars=yes,width=800,height=600,left ......
/********************
* 取窗口滚动条高度
******************/
function getScrollTop()
{
var scrollTop=0;
if(document.documentElement&&document.documentElement.scrollTop)
{
......
a href="#"> 点击链接后,页面会向上滚到页首,# 默认锚点为 #TOP
<a href="javascript:void(0)" onClick="window.open()"> 点击链接后,页面不动,只打开链接
<a href="#" onclick="javascript:return false;"> 作用同上,不同浏览器会有差异。
点击链接后,不想使页面滚到页首,就用href="javascript:v ......