title: what happens when you use javascript to insert a javascript widget?
body: <p>can anyone explain what happens when you use javascript to insert a javascript based widget?</p>
  
  <p>here's my js code:</p>
  
  <pre><code>var para = document.getElementsByTagName("p");
  var cg = document.createElement("div");
  cg.setAttribute("class", "twt");
  cg.innerHTML='&lt;a href="http://twitter.com/share" class="twitter-share-button" 
  data-count="vertical" data-via="xah_lee"&gt;Tweet&lt;/a&gt;
  &lt;script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;';
  document.body.insertBefore(cg, para[1]);
  </code></pre>
  
  <p>it inserts the twitter widget, before the first paragraph. As you can see above, the twitter widget calls for a javascript that shows how many time the page has been tweeted.</p>
  
  <p>doesn't work in Firefox, Chrome, but semi-works in IE8. What should be the expected behavior when this happens? Does the newly inserted js code supposed to execute? If so, how's it differ from if the code is on the page itself?</p>