Search code examples
javascriptasp.nethead

ASP.Net & Javascript: <head> element


I remember my instructor last semester mentioning something about how to sequence JavaScript commands in the HEAD section of my ASP.Net document, but for the life of me, I can't find it in my notes. Are there special concerns about the order Java and other statements inthe HEAD section?

I am putting the Javascript on a .aspx page that is based on a Master Page, if that makes any difference.

Thanks in advance!


Solution

  • No, the sequence doesn't really matter. And you don't need to put your JS in the HEAD section either, unless you're referencing an external JS file. If you're using master pages, and you need a certain JS function on a page, just create the JS function on the page, with the requisite script tags:

    ASPX:

    <script language="javascript" type="text/javascript">
        someFunction = function(){
            //do something
        }
    </script>