أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
basic answer: </body>sends a command to the browser, " there is no more content to show or function". end of story.
I couldnt write a lot of details, so for a detailed answer, kindly have a lok at this: http://stackoverflow.com/questions/436411/where-is-the-best-place-to-put-script-tags-in-html-markup
where else to put it ?! script tags can be put in two places either the head or either the body.
However, placing the script tag at end of body is a good practice as it improves the performance of the page loading since on JavaScript calls, the parser blocks other HTML on your page. so its better to be called after all other components have been loaded.
a lot of reasons to do that , but the most important one:
Javascript file block all other http requests until the JavaScript file is downloaded.
you can't start working (your script) on HTML tags that is not parsed yet.so we put the script in the end of the tag to force browser to read html and then allow script to be applied on html .
because script load after a content
The <body> tag defines the documentation of body.
The <body> element contains all the contents of an HTML document.
because script is we can type in body tag only
Sir because we give reference or in other words we can say that the mapping is done.
we use CSS and other scripting file for look and feel to our HTML pages. Hence in order to use that file we do mapping and give reference to that file.
The <body> element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.
becz we using that tag ..which contents we want in body section means ...we use that body tag