Yes, that worked. Thanks for the tip! On Sat, Sep 4, 2010 at 1:41 AM, yuval dagan <[email protected]> wrote:
> try using the functions: > > scrollBy() <http://www.w3schools.com/jsref/met_win_scrollby.asp> Scrolls > the content by the specified number of pixels > scrollTo()<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 <[email protected]> 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 >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<prototype-scriptaculous%[email protected]> >> . >> 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 > [email protected]. > To unsubscribe from this group, send email to > [email protected]<prototype-scriptaculous%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
