sequence of javascript tag

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
tanvirtonu
Forum Commoner
Posts: 35
Joined: Wed Oct 17, 2007 9:15 am

sequence of javascript tag

Post by tanvirtonu »

I just want to know if the following sequence of javascript code is possible.If possible what are the drawbacks and what are the considerations I should remember.

Code: Select all

 
<script type="text/javascript" src="someFile.js"></script>
 
<script type="text/javascript">
// code goes here
</script>
 
<script type="text/javascript" src="anotherFile.js"></script>
 
<script type="text/javascript" src="anotherFile.js"></script>
 
<script type="text/javascript">
// code goes here
</script>
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: sequence of javascript tag

Post by kaszu »

They all will be loaded in an order as they appear in dom. Browser will stop loading page until JS file is loaded and 'evaluated'.
You should consider putting <script> at the bottom of the <body> instead of <head> where they usually are.
Post Reply