I use this block of code quite often. Almost every project I develop has a login page and I always toss this in to give it that subtle boost to the overall user experience. Once the page has loaded, the cursor location will automatically be set to the username field so the user doesn’t have to grab their mouse or tab over to it just to log in. I’ve seen far too many site that don’t use this and it always frustrates me.
I would also recommend this on any page that has a form element on it that must be filled out. However be careful not to use it on a page that has a form field that the user may not be interested in. A good example of bad placement for this block of code is AVN Ads which sets focus to the search box instead of the username field. Every time I go there I get half way through typing my username and password before it jumps up to the search box and I in my haste I end up typing my password into the search field for all the world to see.