You are right, of course. However, it really depends upon what you want to do with javascript at the time that the external content is loaded. Obviously, you are not ultimately trying to alert 'test'. If the script is something that normally would run onload of a page, I would direct you here:
http://www.dynamicdrive.com/forums/s...ad.php?t=17426
If you need a more involved solution to the onload problem, there is also:
http://www.dynamicdrive.com/forums/s...ad.php?t=13003
However, if you just want to load up a script that requires no initialization and have it available, the Dynamic Ajax Content script has the loadobjs() function for just that purpose. Read the demo page for Dynamic Ajax Content thoroughly for information on its usage.
Finally, if all you really want to do is alert 'test' (from the demo page, addition red):
Code:
<a href="javascript:alert('test');ajaxpage('test.htm', 'contentarea');">test</a>
Bookmarks