That's just because of ordering, though. Test it:
<html>
<body></body>
<head><script>alert(document.body);</script></head>
</html>
works fine. It's not a head vs. body distinction, it's just that the parser is stopped during inline scripts, and doing e.g. getElementById won't work if the script is declared after you.This is why window.onload and then jQuery's document.ready, and later, putting the script at the end of your file, is a best practice.