RJ2003
09-15-2003, 01:07 PM
new to JS...pls educate me .
significance of placing JavaScript in the HTML head section
???
significance of placing JavaScript in the HTML body section
???
It's all chronlogical. If you put this code in the HEAD of the document, it will execute BEFORE the rest of the page loads.
<script type="text/javascript"><!--
alert("Hi!");
//--></script>
If you put it in the BODY section, or right before the ending </BODY> tag, it will execute AFTER the page loads.
However, it is more common to use event handlers to call a function rather than simply auto-execute JavaScript coding.
<script type="text/javascript"><!--
function alert_text(){
alert("Hi!");
}
//--></script></head>
<body onload="alert_text();">
[J]ona