Return to Snippet

Revision: 4687
at January 15, 2008 22:38 by multani

Initial Code
<script language='javascript'>

function move_up() {
scroll_clipper.scrollTop = 0;


<a href='javascript:move_up()'>Move UP</a>


<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

scroll_clipper defines the scroll area while scroll_text
defines the text to be scrolled.


Initial URL

Initial Description
This script can help you control the scroll of div by a simple function.
Set thr property 'scrollTop' then the scoll can be controlled.

Initial Title
scroll to top - JavaScript

Initial Tags
javascript, DOM

Initial Language