JavaScript对滚动条的操作

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>在div区域双击鼠标可以看到效果</title>
		<script type="text/JavaScript">
			var currenTop,timer;
			function endScroll(){
				clearInterval(timer);
			}
			function divScroll(){
				currenTop = document.getElementById("test").scrollTop;
				document.getElementById("test").scrollTop = ++currenTop;
			}
			function beginScroll(){
				timer=setInterval ("divScroll()",30);
			}
		</script>
	</head>
	<body>
		<div id = "test" style="background-color:green; width: 120px; height: 360px; overflow: auto;" onmousedown="endScroll();" ondblclick="beginScroll();">
			1<br>2<br>3<br>
			4<br>5<br>6<br>
			7<br>8<br>9<br>
			10<br>11<br>12<br>
			13<br>14<br>15<br>
			16<br>17<br>18<br>
			19<br>20<br>21<br>
			22<br>23<br>24<br>
			25<br>26<br>27<br>
			28<br>29<br>30<br>
			31<br>32<br>33<br>
			34<br>35<br>36<br>
			37<br>38<br>39<br>
			40<br>41<br>42<br>
			43<br>44<br>45<br>
			46<br>47<br>48<br>
			49<br>50<br>51<br>
			52<br>53<br>54<br>
			55<br>56<br>57<br>
		</div>
		  
	</body>
</html>

JavaScript对滚动条的操作,布布扣,bubuko.com

JavaScript对滚动条的操作

上一篇:[C/C++]_[VS2010源码中使用UTF8中文字符串被转码为ANSI的问题]


下一篇:Python 基础学习 网络小爬虫