I like to make it clear.
Do you recomend me to use outer javascript which is something like <script src=‘outer.js’ type=‘text/javascript’></script> instead of inline javascript?
There are two different techniques that would apply here.
The first technique is using an external script file as opposed to inline scripting.
This is an example of inline scripting (not recommended):
<script type="text/javascript">
// script code here
</script>
Some of the problems with inline scripting is that it’s not portable, and there may be character code issues where parts of the script are interpreted as if they were HTML code. Some people tend to use inline scripting for testing, or development, and it can make it easier to post working solutions to the forum. Such behaviour though is not to be construed as support for inline scripting.
The preferred technique is to place your scripts in a separate file
I find it interesting that you talk about attaching an onload event to the document.body and not the window.
I used to do the same thing by default, either in the html or in the js, until I read somewhere that window.onload is better. The reason, they said, is because even though the <body> has finished loading images referenced in <img>'s might not have finished downloading yet (since they are downloaded in parallel to the rest of the <body>) whch could then interfere with other behaviours (via js or whatever) on the page.
But when the window.onload event is triggered then the <body> element and all the images have finished loading into the browser.
Is this correct or are there other differences between document.body.onload and windpw.onload?