javascript caching (maybe)?
<p>I have a need to remove an element from my screen and then regenerate an element with the same name.</p>

<p>In the code there is a deleteObject function and a appendChild call.</p>

<p>In the deleteObject function it is removing the element(s) by using the removeChild statement (as seen below).</p>

<p>See this <a href="http://jsfiddle.net/uwtj9/10/" rel="nofollow">jsfiddle</a> for what I'm trying to accomplish.  Right now the fiddle works but my code still does not.  I think it has to do with the "top" keyword.  See this <a href="http://stackoverflow.com/questions/7923601/javascript-top-keyword">question</a> for my thoughts on that.</p>

<p>Like I said earlier I have an element called "container1" that needs to be removed and then I have a new "container1" that needs to be created.  When I remove the code out of the deleteObject function my new "container1" displays, however, when I include the code it appears to conflict and the new "container1" never gets displayed.</p>

<p>I'm wondering is there some sort of javascript caching that is going on?  As the remove and create functions are called back to back.  Is there a way that I can use the code that I have but add some sort of delay? </p>

<p>Any advice appreciated!</p>

<pre><code>    function deleteObject(id) {
        try {
            var obj = document.getElementById(id);
            obj.parentNode.removeChild(obj);
        } catch (e) {}
        //do something
    }

function hidePopWin() {
    if (gPopupMask == null) {
        return;
    }

    deleteObject('popupMask_' + popuplayer);
    deleteObject('popcont_' + popuplayer);

    popuplayer--;

    if (popuplayer == 0) {
        gPopupIsShown = false;
        gPopupContainer = this.undefined;
        gPopupIframe = this.undefined;
    } else {
        var showmask = document.getElementById('popupMask_' + popuplayer);
        if (showmask) {
            showmask.style.display = "block";
            gPopupContainer = document.getElementById("popcont_" + popuplayer);
            gPopupIframe = document.getElementById("iframe_layer" + popuplayer);
        }
    }
    //console.log("got here: " )
}
</code></pre>

<p><strong>UPDATE:</strong>
This <a href="http://jsfiddle.net/uwtj9/10/" rel="nofollow">jsfiddle</a> is more accurately displaying what is going on(however, in the fiddle it works, but internally it doesn't): See this <a href="http://stackoverflow.com/questions/7923601/javascript-top-keyword">question</a> for further information</p>
