<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> //取得页面body的信息,如高/宽,卷去上/左. yenange, 11/25/2011 function GetPageInfo() { var PageInfo = {}; PageInfo.Height = document.body.clientHeight ? document.body.clientHeight : document.documentElement.clientHeight; PageInfo.Width = document.body.clientWidth ? document.body.clientWidth : document.documentElement.clientWidth; PageInfo.ScrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop; PageInfo.ScrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft; return PageInfo; } function test() { $("#span0").text(GetPageInfo().Height); $("#span1").text(GetPageInfo().Width); $("#span2").text(GetPageInfo().ScrollTop); $("#span3").text(GetPageInfo().ScrollLeft); } </script> </head> <body> <div style="width:1500px;height:1000px;" > <table id="table1" border="1" cellspacing="1" cellpadding="2" > <tr> <td style="width:300px;" >PageInfo.Height</td> <td style="width:200px;" ><span id="span0" ></span></td> </tr> <tr> <td>PageInfo.Width</td> <td><span id="span1" ></span></td> </tr> <tr> <td>PageInfo.ScrollTop</td> <td><span id="span2" ></span></td> </tr> <tr> <td>PageInfo.ScrollLeft</td> <td><span id="span3" ></span></td> </tr> </table> <input id="btnTest" type="button" value="取得页面信息" οnclick="test()" /> </div> </body> </html>