Suppose I have this code :
<head>
<script type="text/javascript">
func1();
</script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
func2();
</script>
<script type="text/javascript" src="tabber.js"></script>
</head>
Would func2() be called only after jquery.js is completely loaded? Basically I am trying to make a progress bar in a page with some heavy javascript code. So I want to know how much of the page has loaded.Now I can show this progress in the form of the number of js files that have been completely downloaded. So if func2() is called only after jquery completely loads, I can use that function to slide up the progress bar by some percentage.
JavaScripts in a page will be executed immediately while the page loads into the browser. The exception is when it’s told to fire on an event (ie: click, after page load, etc)
If you want to ensure code is run only after the page is loaded you can use:
Note: put your Javascript in tags as well.