title: Select all text in a 'readonly' <input /> when it gains focus
body: <p>I've got a textbox (set to readonly) and I need its' contents to be selected for easy copy/paste when it gains focus.  Using the code below it only seems to quickly select the text and then unselect it for some reason.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input id='thing' type='text' value='some text' readonly='readonly' /&gt;​
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>document.getElementById('thing').onfocus = function(){
      this.select();
  };​
  </code></pre>
  
  <p><strong>Fiddle</strong>: <a href="http://jsfiddle.net/cfqje/" rel="noreferrer">http://jsfiddle.net/cfqje/</a></p>