Forum Moderators: open
My bank's site uses this. The script executes after all the images (and Flash animation telling me I should refinance my home: 180K download) have loaded. I don't wait for everything to load. I go on "auto-pilot" when I do my on-line banking, and I'm sure others do, too.
I click the text field, and begin typing my username and password. I'm there for a reason, and I use the web since it's faster than listening to a phone menu.
It's annoying when I type my username, hit tab, and begin to type my password, and half the password is in front of my username when I get ready to submit. (Or worse, I hit "enter" after the "deadline" and it tells me it's incorrect after submission.) I then have to delete that little snippet of password, then re-type my password in the correct field. Extra un-needed step.
Yes, I could disable Javascript, but the site uses it to check my entries prior to submission, and the "Submit" button isn't a submit button, but a normal form button with an onclick() handler (validates format prior to submission, IE dollars and cents, no extraneous characters). Submission of my transfers, etc. happens from Javascript. So disabling javascript would not work in this case.
Of course, I could wait the 30 seconds for the whole page to load and place the cursor there for me, but by then the web loses the speed advantage. I might as well have used the phone in the first place. :)
I've just thought of a way to reduce the pause for larger pages. You don't have to use the body onLoad event to use the focus() method. Instead, you could put the focus() method inside script tags just after the field. This way, the method is called just after the browser renders the field but while the rest of the page, images etc are still downloading.
Something to watch out for: you might need to put your script after the </form> tag to make sure the form has been rendered before the script executes, and if the form is inside a table I'd imagine you'd need to put the script after the </table> tag for the same reason.