Auto Scroll to Bottom of DIV on Load with JavaScript
<pre><code>window.setInterval(function() { var elem = document.getElementById('chat'); elem.scrollTop = elem.scrollHeight; }, 5000)
</code></pre>

<p>That works fine. When trying to alter this so that it just scrolls once on load:</p>

<pre><code>window.onload(function() { var elem = document.getElementById('chat'); elem.scrollTop = elem.scrollHeight; })
</code></pre>

<p>It fails. What am I doing wrong?</p>

<p>Updated code:</p>

<pre><code>window.onload = function() { var elem = document.getElementById('chat'); elem.scrollTop = elem.scrollHeight; }
</code></pre>

<p>Still no go.</p>

<p>Thanks</p>
