using document.write a good solution but there is problem with it if you don't use it carefully.
Consider you want to use "1.
js" in "2.
js". and consider these tow simple file:
---------- 1.
js -------------
alert("1");
-----------------------------
and
---------- 2.
js -------------
document.write('<script language="javascript" src="1.
js"></script>');
alert("2");
-----------------------------
in this case if you include "2.
js" in your html file both file will load
but your browser while show
2 before
1 and I'm sure it's not your desire.
To Solve the problem use these three file instead:
---------- 1.
js -------------
alert("1");
-----------------------------
and
-------- 2_main.
js ----------
alert("2");
-----------------------------
and
----------- 2.
js ------------
document.write('<script language="javascript" src="1.
js"></script>');
document.write('<script language="javascript" src="2_main.
js"></script>');
-----------------------------
then include just "2.
js" in your html file. It will alert 1 then will alert 2 and the sequence will be your desire.
Take care budies.