title: Placing script tag in div and execute
body: <p>I'm building a small advertisement system for my website so that I can just add new ads in the database. Most ads consists of images and I will just write an image as innerhtml to a div. This works fine.
  However, some ads consists of a script tag only that should be placed where the ad is wanted. Since I have to do this dynamically from either code behind in .NET or from an ajax call, I have some problems with this.
  Just setting a innerhtml of a div like this:</p>
  
  <pre><code>&lt;div id="asdf" runat="server"&gt;
      &lt;script type="text/javascript" src="xxxxx"&gt;&lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>... won't work since it won't get executed. No matter if i set it in the code behind on page load, or set with an ajax call.</p>
  
  <p>I might be able to call eval() somehow, but this doesn't guarantee the script will be placed exactly where i want it to be if I got it right.</p>
  
  <p>Any ideas? This can't be a new problem, many advertising networks has script tags instead of images and such.</p>
  
  <p><strong>Edit:</strong> The javascript file is located on another domain. Everything works if i set the src attribute to a local file containing only an alert! Can't you make this happen across domains?</p>