That’s a good point, Lewis. The way we do it at Yahoo! is to place the JavaScript as low down in the body as possible, ideally just before the closing body tag. Not only is this useful for doing away with onload events, it also has benefits in perceived page load time. Browsers tend to hold off loading other things whilst JavaScript is downloading, so if you have the script tags at the bottom, the user at least has something to look at whilst the download occurs.
That’s an optimisation you can make, but first it’s important to understand and master the most common methods, I think.
That’s a good point, Lewis. The way we do it at Yahoo! is to place the JavaScript as low down in the body as possible, ideally just before the closing body tag. Not only is this useful for doing away with onload events, it also has benefits in perceived page load time. Browsers tend to hold off loading other things whilst JavaScript is downloading, so if you have the script tags at the bottom, the user at least has something to look at whilst the download occurs.
That’s an optimisation you can make, but first it’s important to understand and master the most common methods, I think.