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.


<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;



<div id="mainFrame"></div>


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 
For more options, visit this group at 

Reply via email to