I think some developers have just gotten it into their heads that the way to run scripts is through event handlers and external script files, and something simple like putting a one-line inline script in the middle of the page, right after the form code itself, is somehow abhorrent to them.
To be fair, the consensus, at least among developers (and computer science professors) I know, is that it's stylistically better to avoid inline script wherever possible. IMHO, developers should never move the cursor except as a predictable response to appropriate user input (e.g. it's okay to move the cursor from the area code box of a phone number to the box for the first three digits proper after I've typed the area code (though I'd prefer if pages that do so would remember when they've just done it and ignore a subsequent 'tab' press)).
Stylistically cleaner, but IMO there are times when usability (or even functionality) are more important than coding style.
Edit: Not that one should ignore coding style entirely -- just that if they come into conflict, such that sticking to the style would result in significantly worse performance, user experience, etc., one is better off breaking out of the style in that case.
Now, keep in mind web development's not my primary focus. I've made a few minor changes to some asp.net pages for one of my company's products, but most of my experience is in Windows-based applications. Nevertheless, I'd be astonished (and a bit disgusted) if there isn't an easy way to specify a default cursor position without resorting to inline script.
Edit: And making it happen before the page finishes loading.
There's an autofocus attribute in HTML5, but it's still in development and I think Opera's the only browser that supports the attribute so far. (Most of the current non-IE browsers have partial HTML5 support, but of course they all support different parts of the spec.) Which means a scripting workaround is necessary to make it work for 99% of web users.
At its heart, HTML is still a document markup language, with various capabilities tacked on over the years in an ad-hoc manner. HTML5 is the first update to really take into account the fact that people are using it as an application platform.
Comments
Thank you!!! I hate that SO MUCH.
Edit: Not that one should ignore coding style entirely -- just that if they come into conflict, such that sticking to the style would result in significantly worse performance, user experience, etc., one is better off breaking out of the style in that case.
Edited at 2009-01-19 05:06 pm (UTC)
Now, keep in mind web development's not my primary focus. I've made a few minor changes to some asp.net pages for one of my company's products, but most of my experience is in Windows-based applications. Nevertheless, I'd be astonished (and a bit disgusted) if there isn't an easy way to specify a default cursor position without resorting to inline script.
Edit: And making it happen before the page finishes loading.
Edited at 2009-01-20 01:27 am (UTC)
At its heart, HTML is still a document markup language, with various capabilities tacked on over the years in an ad-hoc manner. HTML5 is the first update to really take into account the fact that people are using it as an application platform.