> Run script, all the elements outside of my function disappear?

Run script, all the elements outside of my function disappear?

Posted at: 2014-12-18 
This is the reason why one shouldn't use document.write(), ever.

If you call it directly while a document is loaded, it'll work, but here you call it after the page has fully loaded, and in that case it will simply replace the document content.

The proper way is to use .innerHTML:



and

document.querySelector( "#container").innerHTML = "" + turn_to_html(xmlDoc) + "
";

Ok, so I am trying to update a table with elements from an xml doc. The user selects a table to load from a selection box and the current table is removed and a new one is opened. I have not found a way to do this properly yet. Currently, my code will update the contents of the table when the user makes a selection, but everything outside of the table disappears; including the style properties. Why is that? Can anyone take a look at my code and figure out what's wrong