Try to reorder
<script type="text/javascript" src="js2.js"></script> <script type="text/javascript" src="js1.js"></script> <script language="javascript"> js1(); </script>
Because you are calling js2(); inside js1.js , so the js2.js script should be executed earlier.
In your case, I think it should still work without changing the order, since you are calling js2(); inside the function. When this script is executed:
function js1() { alert("Hello from js1"); js2(); }
Even js2.js is not executed yet, but you are not actually calling js2(); at that time.
Just try to see if it works.
source share