Forum Moderators: open
THIS WORKS
//fill the contents of the new tab's panel
newTabPanel.innerHTML = "News Content";
THIS DOES NOT
//fill the contents of the new tab's panel
newTabPanel.innerHTML = "<script type="text/javascript" src="http://cdn.example.com/syndication/subscriber/InsertWidget.js"></script><script>if WIDGET) WIDGET.renderWidget('e2945c57-ab31-42c7-ac07-00369856e292');</script><noscript>Get the <a href="http://www.example.com/widget/meta...-inocom">Metal Futures Quotes - example.com</a> widget and many other <a href="http://www.example.com/">great free widgets</a> at <a href="http://www.example.com">Widget</a>! Not seeing a widget? (<a href="http://docs.example.com/using-widg...-widget/">More info</a>)</noscript>";
[edited by: whoisgregg at 7:13 pm (utc) on Dec. 21, 2009]
[edit reason] Removed specifics, please use "example.com" Thanks! :) [/edit]
In order to inject JavaScript code into the page, you have to eval() the new code. If you want to be able to mix regular HTML and <script> blocks when updating the content of a <div> then I'd recommend taking a look at how the open source javascript libraries provide that functionality.
I know Prototype, jQuery, and the YUI Library all offer this functionality. Even if you don't want to just take advantage of those entire libraries, you can still peak at their code for how to do it yourself.