Alert() from an Ajax loaded page?

Here’s a simple function for adding scripts to the page so that you can add as many scripts as you like by calling that function as shown in the last line simply by supplying the filename (and path if there is one).

var addJS = function(nm) {
  var s = document.createElement('script');
  s.type='text/javascript';
  s.src=nm;
  document.getElementsByTagName('body')[0].appendChild(s);
}

addJS('newScript.js');

See also http://www.felgall.com/jstip128.htm which at the bottom gives an example where scripts dynamically replace one another so that which one runs depends on when you call it.