案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
$(document).ready(function(){
6
  $(".btn1").click(function(){
7
    alert($("div").scrollTop()+" px");
8
  });
9
});
10
</script>
11
</head>
12
<body>
13
<div style="border:1px solid black;width:200px;height:200px;overflow:auto">
14
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.
15
</div>
16
<button class="btn1">获得 scrollbar top offset</button>
17
<p>试着移动滚动条,然后再次点击按钮。</p>
18
</body>
19
</html>
20