/ Published in: JavaScript
This script can help you control the scroll of div by a simple function.
Set thr property 'scrollTop' then the scoll can be controlled.
Set thr property 'scrollTop' then the scoll can be controlled.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script language='javascript'> function move_up() { scroll_clipper.scrollTop = 0; } </script> <a href='javascript:move_up()'>Move UP</a> <p> <div id='scroll_clipper' style='position:absolute; width:150px; height: 150px; overflow:auto'> <div id='scroll_text' style='background-color:yellow'> Here is some content that can be scrolled. <p>It uses two divs:<ul> <li>scroll_clipper, and <li>scroll_text </ul> scroll_clipper defines the scroll area while scroll_text defines the text to be scrolled. </div> </div>
URL: http://www.thescripts.com/forum/thread94146.html