Scrolling div by the #id, what am I doing wrong?
<p>I'm programming a message board for my site. Every message gets an id by auto increment in the database. The messages on the board are under "li id=#" tags where the "li" gets the id from the database. I've tried to create scrolling function via javascript so that down and up arrows would move across whole messages.</p>

<p>This is what I've got so far:</p>

<pre><code>down.node.onclick = function() { // down arrow

var msgs = document.getElementById("kommentit"); // the &lt;ul&gt; element
var a = new Array();


if (msgs.hasChildNodes()) {
    var children = msgs.childNodes;
    for (var i = 0; i &lt; children.length; i++) {
        if (msgs.childNodes[i].tagName == "LI") {
            a.push(msgs.childNodes[i].id); // array with the id's
        }
    }

}

for (var i = 0; i &lt; a.length; i++) { // this is what goes wrong
    parent.location.href = '#' + 'a[i + 1]';
}
</code></pre>

<p>So while the array gets the right values the actual function doesn't work. With this code I get .../index.php#[a + 1] as my url when I click.</p>

<p>If I use ''+a[i + 1]+'' the page refreshes through the whole array until it settles with #undefined.</p>

<p>The id's are in format "id-xx" so is that the problem? I tried splitting the id by using msgs.childNodes[i].id.split("id-") but if I do this I get ",xx" as my values in the array.</p>
