[javascript] Selecting all text in HTML text input when clicked

input autofocus, with onfocus event:

<INPUT onfocus="this.select()" TYPE="TEXT" NAME="thing" autofocus>

This lets you open a form with the desired element selected. It works by using autofocus to hit the input, which then sends itself an onfocus event, which in turn selects the text.