Forum Moderators: open

Message Too Old, No Replies

Implement a "div" that can be programmatically scrolled

PROGRAMMATICALLY scroll

         

srivalli9

9:56 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



I'm wondering how one could implement a "div" that can be programmatically scrolled.

I have a "div" element with both horizontal and vertical scrollbars.
The "div" element internally has a table with 100 rows.
Only 10 rows are visible at a time.
I want to PROGRAMMATICALLY scroll the "div" so that the rows from 70 to 80 are visible.

I'm a newbie to javascript.
hence any help is greatly appreciated!

srivalli9

11:32 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



Hi,
I could get it working using the scrollTop property of the div element.

document.getElementById('scrollingDivElement').scrollTop = obj.offsetTop;

obj is the 70th row object.

-Srivalli.

orion_rus

1:27 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Are u sure u need it, u can't use a mousewheel in a Mozilla/Netscape broswers to scroll. I think the best way is to set to this div style='overflow:scroll' and all will be fine
Good luck to you

Rambo Tribble

2:12 am on Mar 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Windows and frames can also be scrolled by scripts. This includes iframes, which can be used much like divs and might be useful if the table content is kept as a separate document.