jQuery frameset 对象的操作及scrollTop

<frameset rows="*" cols="195,*" frameborder="no" border="0" framespacing="0">
<frameset rows="61,*,48" cols="*" frameborder="no" border="0" framespacing="0">
<frame src="tree_top.html" name="leftFrame" scrolling="no" noresize="noresize" id="leftFrame" title="leftFrame" />
<frame src="treeMenu.jsp" name="treeMenuFrame" scrolling="auto" id="treeMenuFrame" title="treeMenuFrame" marginheight="0" marginwidth="0"/>
<frame src="login_bottom.jsp" name="loginFrame" scrolling="no" id="loginFrame" title="loginFrame" />
</frameset>
<frame src="content.jsp" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>

 

 

login_bottom.jsp要操作content.jsp页面中的id为"login"的对象:

jQuery(window.parent.parent.frames["mainFrame"].document).find('div[@id="cover"]')

 

获取整个页面的高度包括滚动后的高度

jQuery(window.document).height()

 

滚动的时候scrollTop一直为0的解决方法:

写法有误不是 document.body.scrollTop 而是 document.documentElement.scrollTop

top、clientTop、scrollTop、offsetTop
2007-09-17 15:06

jQuery frameset 对象的操作及scrollTop
<html>
<head>
<title>51windows.Net </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
var   s = "";
s += "\r\n网页可见区域宽:"+ document.body.clientWidth;
s += "\r\n网页可见区域高:"+ document.body.clientHeight;
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>
</html>

 

你可能感兴趣的:(scrollTop)