No, this is the behavior of Internet Explorer.
If you attach scripts dynamically, IE, Firefox, and Chrome will all download the scripts in an asynchronous manner.
Firefox and Chrome will wait till all of the async requests return and then will execute the scripts in the order that they are attached in the DOM but IE executes the scripts in the order that they are returned over the wire.
Since the alert takes less time to “retrieve” than an external javascript file, that likely explains the behavior that you are seeing.
From Kristoffer Henriksson’s post on the subject of asynchronous script loading:
In this scenario IE and Firefox will
download both scripts but Internet
Explorer will also execute them in the
order they finish downloading in
whereas Firefox downloads them
asynchronously but still executes them
in the order they are attached in the
DOM.In Internet Explorer this means your
scripts cannot have dependancies on
one another as the execution order
will vary depending on network
traffic, caches, etc.
Consider using a Javascript loader. It will let you specify script dependencies and order of execution while also loading your scripts asynchronously for speed as well as smoothing out some of the browser differences.
This is a pretty good overview of a few of them: Essential JavaScript: the top five script loaders.
I’ve used both RequireJS and LabJS. In my opinion, LabJS is a little less opinionated.