Div的滚动栏控制
1 2 3 4 5 6 |
<a href="javascript:questions.scrollTop = 0;">Move to Top</a> <a href="javascript:questions.scrollTop = questions.scrollHeight;">Move to buttom</a> <div id=questions> # content for div questions. </div> |
scrollTop gets or sets the number of pixels that the content of an element is scrolled upward.
// Set the number of pixels scrolled
element.scrollTop = intValue;
scrollTop can be set to any integer value, however:
If the element can't be scrolled (e.g. it has no overflow), scrollTop is set to 0.
If set to a value less than 0, scrollTop is set to 0.
If set to a value greater than the maximum that the content can be scrolled, scrollTop is set to the maximum.
Posted by devon At May 19, 2008 15:09
请登录以发表评论。