try using the functions:

scrollBy() <http://www.w3schools.com/jsref/met_win_scrollby.asp>Scrolls the
content by the specified number of
pixelsscrollTo()<http://www.w3schools.com/jsref/met_win_scrollto.asp>
http://www.w3schools.com/jsref/obj_window.asp

<http://www.w3schools.com/jsref/obj_window.asp>yuval

On Fri, Sep 3, 2010 at 7:02 PM, sentor <rockclimb...@gmail.com> wrote:

> Hi All,
>
> Total Newb question (new to java script ajax and prototype). The code
> below calls a cgi, which returns some html which appears under
> mainFrame.  I'm using PeriodicalUpdater and as you can see, the cgi is
> called every second.  Works like a champ.  The one hurdle I have yet
> to overcome is always having the scroll bar at the bottom of the
> page.  So, similar to a chat box, I always want to see the latest data
> at the bottom of the screen, without manually scrolling down.
>
> I found a thread that proposed using the onComplete, or even the
> onSuccess event to achieve this.  It's implemented below. however, it
> doesn't seem to work.
>
> Any help you can offer is greatly appreciated.
>
> ---------------
> <html>
> <head>
>
> <script type="text/javascript" src="prototype.js"></script>
> <script type="text/javascript">
>
> var container = 'mainFrame';
> var url = '/cgi-bin/sessions.cgi';
> new Ajax.PeriodicalUpdater(container, url, {
>    method: 'get',
>    insertion: Insertion.Bottom,
>    frequency: 1,
>    decay: 0,
>    onComplete: function() {
>    (function() {
>        container.scrollTop = container.scrollHeight;
>        });
>    }
>  });
>
> </script>
>
> </head>
> <body>
>
> <div id="mainFrame"></div>
>
> </body>
> </html>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to