I would like to know what code to use if I want to put the focus on a button?

I know how to put a focus on a textfield of some kind...

but if I have just a button (onClick=window.close() without a form, how do I, upon loading the page, give this button the main focus...

so, if someone presses the Spacebar or Enterkey the window will be closed immediately.