Quote:
Originally Posted by felgall
Yes the declarations go at the top - both those declared via the JavaScript var statement AND ALL the HTML that the JavaScript code needs to reference - hence the actual JavaScript code ends up immediately before the </body> tag so that all the declarations it needs to reference go above it.
|
Thank you. I thought it was clear for everybody why scripts should be on the bottom of
<BODY> not on the top or in the middle.
My question, actually, was, why not in the
<HEAD>, where they could peacefully sleep, until called?
I think the <head> section was included into HTML mostly for that purpose (to keep executable code sleeping) otherwise I do not see any big reason, rather then decorative, to have this special section of HTML.
So I "refactor"

my initial question.
Why to keep scripts in the <body>, not in the <head>?