用户名:
密 码:

js获取内容层内容原始尺寸 滚动条高度 页面实际大小

js获取内容层内容原始尺寸 滚动条高度 页面实际大小
这里提供三种js函数,分页是 获取内容层内容原始尺寸 获取滚动条的高度 获取页面实际大小的js代码哦。
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>js获取内容层内容原始尺寸 滚动条高度 页面实际大小</title>
<script language="网页特效">
获取内容层内容原始尺寸
function getconsize(conid){
var conobj=document.getelementbyid(conid)
conobj.style.position = "absolute";
conobj.style.left=-1000+"px";
conobj.style.display="";
var arrayconsize=[conobj.offsetwidth,conobj.offsetheight]
conobj.style.display="none";
return arrayconsize;
}
function insertafter(newelement,targetelement){//插入
var parent = targetelement.parentnode;
if(parent.lastchild == targetelement){
parent.appendchild(newelement);
}
else{
parent.insertbefore(newelement,targetelement.nextsibling);
}
}
//获取滚动条的高度
function getpagescroll(){
var yscroll;
if (self.pageyoffset) {
yscroll = self.pageyoffset;
} else if (document.documentelement  &&  document.documentelement.scrolltop){
yscroll = document.documentelement.scrolltop;
} else if (document.body) {
yscroll = document.body.scrolltop;
}
arraypagescroll = new array(’’,yscroll)
return arraypagescroll;
}
//获取页面实际大小
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){
sscroll = document.body.scrollwidth;
yscroll = document.body.scrollheight;
} else {
xscroll = document.body.offsetwidth;
yscroll = document.body.offsetheight;
}
var windowwidth,windowheight;
//var pageheight,pagewidth;
if (self.innerheight) {
windowwidth = self.innerwidth;
windowheight = self.innerheight;
} else if (document.documentelement  &&  document.documentelement.clientheight) {
windowwidth = document.documentelement.clientwidth;
windowheight = document.documentelement.clientheight;
} else if (document.body) {
windowwidth = document.body.clientwidth;
windowheight = document.body.clientheight;
}
var pagewidth,pageheight
if(yscroll < windowheight){
pageheight = windowheight;
} else {
pageheight = yscroll;
}
if(xscroll < windowwidth) {
pagewidth = windowwidth;
} else {
pagewidth = xscroll;
}
arraypagesize = new array(pagewidth,pageheight,windowwidth,windowheight)
return arraypagesize;
}
</script>
</head>
<body>
</body>
</html>

广州域名注册 金山域名注册 闵行域名注册 北京域名注册 徐汇域名注册 上海域名注册

.

  来源:互联网
阅读:
日期:2010-9-3
 
收藏此文 】 【 打印此文 】   
  • 上一篇:php 上传图片并按比例生成指定大小图
  • 下一篇:没有了
  • TAG: js获取内容层内容原始尺寸 滚动条高度 页面实际大小
    • 官方网址: dns110.com
    • CopyRight © 2010 域名频道 版权所有
    • 地址:上海市松江区新松江路1188弄37号 邮编:201620
    • 电话: 021-67820741 67820742 67820743 传真: 转分机805 值班电话: 021-67820743
    • 在线支持QQ: 219854  客户服务QQ:714658643  MSN:chenlh@dns110.com  Email: support@dns110.com
    • 沪ICP备06024974号