JavaScript对滚动条的操作

来源:互联网 发布:锻造模拟软件 forging 编辑:程序博客网 时间:2024/06/16 20:50
<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>
1 1
原创粉丝点击