Fair warning: although it is defined by the HTML 4.01 standards, only Internet Explorer 4.0 and higher implements the technique described in this article.
With a defer attribute you can define all your code in one block and simply mark it as defer, which would have the same exact effect of moving all your code to the bottom of the page, regardless of where it actualy resides.
you're stuck by ancient rules like this or you just want to enforce some standard readability on your pages, the defer attribute will let you put your code where it makes sense to you and still have the page load optimally.
The defer attribute works on both in-line and external scripts.
There is a very good and thorough analysis, detailing exactly how Internet Explorer handles script deferral here: http://www.websiteoptimization.com/speed/tweak/defer/. This article is actually several years old but the information is still current through Internet Explorer 7.0
Unfortunately, defer is supported only in Internet Explorer right now even though it is a part of the official 4.01 specification. Mozilla is aware of the problem as there's a seven year old open bug tracking it. Additionally the whatwg (the advisory body working on the next generation of HTML) has more fully described how defer should behave in future browser versions.
If you check out the whatwg page you'll see that there's also an async attribute in the pipes (tubes?) which will tell the browser to initiate the loading of the script and then continue to build the page, executing the script only after it's finished loading. ( A nifty feature in its own right! )
Even though defer doesn't work in Firefox and Opera right now, they will simply ignore the attribute. As this attribute becomes fully supported these browsers will eventually benefit from the page optimization just like IE.
Just one more tool for your toolbox. Happy coding!