On Apr 8, 2008, at 6:23 PM, Jake McGraw wrote:

Regardless of whether it validates, it's considered best practices to
keep all <script> tags out of the body:

It all depends who "consideres".

http://developer.yahoo.com/performance/rules.html#js_bottom

If you put your scripts at the very end of a page, it is possible that
a user already sees part of the page including a button with a
JavaScript function call, while the rest of the page hasn't loaded
yet. Result: user pushes button and gets JavaScript Error Message
Alerts, because the browser can't find the script (yet).


True, if you do things like:

<input type="button" onclick="checkform()"  />

Then again not a problem if you write unobtrusive JavaScript.

$(function() {
    $("input").bind("click", checkform);
});

And isn't jQuery about writing unobtrusive JavaScript? ;)

--
Mika Tuupola
http://www.appelsiini.net/

Reply via email to