关于JS的滚动条代码
发布网友
发布时间:2022-05-02 11:25
我来回答
共1个回答
热心网友
时间:2022-05-14 17:31
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){ var b;
$("#btn1").click(function(){
var a=$("div").scrollTop();
if(a<b){ alert('上');}else{ alert('下');}
b=a;
});
});
</script>
</head>
<body>
<div style="border:1px solid black;width:200px;height:200px;overflow:auto" class="btn1">
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 id="btn1">点一下</button>
</body>
</html>