JS removeNode problem FF 4.01
<p>Can someone check this for me:</p>

<pre><code>function on_message_start () {
    messageDiv = document.getElementById("on_message");

    //add close button
    aClose = document.createElement("a");
    aClose.setAttribute("href", "#");
    aClose.setAttribute("id", "messageClose");
    textClose = document.createTextNode("Close");
    messageDiv.appendChild(aClose);
    aClose.appendChild(textClose);

    //message close action
    aClose.onclick =  function() {
        on_message_close (messageDiv);
        return false;
    };
}

function on_message_close (messageDiv) {
    document.removeChild (messageDiv);
}
</code></pre>

<p>For the life of me I can't figure out why <strong>document.removeChild (messageDiv);</strong> does not remove the div as expected.</p>

<p>on_message_close is called, messageDiv is passed correctly, is an immediate child of document and it is a div.</p>

<p><strong>edit</strong>
Found the solution:</p>

<pre><code>function on_message_close (messageDiv) {
    alert (messageDiv.getAttribute("id"));
    parent = messageDiv.parentNode
    parent.removeChild (messageDiv);
}
</code></pre>

<p>I thought I'd tried that before asking...</p>
