By first line of Javascript I meant the JS code inside tags with no "src" attribute.
views:
79answers:
2
+1
A:
By right it will be evaluated top down.
Read more about it from my previous answer: http://stackoverflow.com/questions/1795438/load-and-execution-sequence-of-a-web-page/1795502#1795502
Let me explain here:
<script type="text/javascript">
alert(jQuery); // alerts jQuery's namespace
</script>
<script type="text/javascript" src="jquery.js"></script>
The result is alerting undefined
.
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
alert(jQuery); // alerts jQuery's namespace
</script>
The result is alerting a object/function where defined.
thephpdeveloper
2009-12-17 00:18:00
+1
A:
The scripts are executed in the order they are listed in the html. It does not matter if they are inline JavaScript (within <script>
tags) or if loaded as external scripts (<script src="xx.js">
).
Hippo
2009-12-17 01:32:32