Add javascript in the middle of the html file

Can I add javascripts in the middle of my page or it should be btw <head></head>?


.
.[I]html codes[/I]
.
<script src=scripts.js language="javascript" type="text/javascript"></script>
.
.[I]html codes[/I]
.
.

To be as unobtrusive as possible:

<script type=“text/javascript” src=“external.js”></script>
</head><body>

And then put all the necessary javascript code into its own separate external.js file.

Can I add javascripts in the middle of my page
You can, but you shouldn’t. The idea is to keep the javascript(called the behavior) separate from the html(called the structure), and to keep the css(called the presentation) separate as well. It makes maintenance(i.e. the ability to change things) easier.

The best practice is to link to a javascript file using script tags in the <head> by using a src attribute in the script tags. The next best practice is to put the javascript directly in the <head>.

You can put them (with src=) anywhere you like. But lose the ‘language=’ attribute-
the only browsers that use ‘language’ will download javascript files without it.
They only pay attenton if a version number is specified.