87,923
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var h = 0
$(".btn1").click(function(){
h += 100;
$("div").scrollTop(h);
});
$(".btn2").click(function(){
if(h<=0){
return;
}
h -= 100;
$("div").scrollTop(h);
});
});
</script>
</head>
<body>
<div style="border:1px solid black;width:200px;height:200px;overflow:auto">
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.
</div>
<button class="btn1">down</button>
<br />
<button class="btn2">up</button>
</body>
</html>