title: Setting focus on a text box on page load
body: <p>I have already tried the information in <a href="https://stackoverflow.com/questions/45827/how-do-you-automatically-set-the-focus-to-a-textbox-when-a-web-page-loads">How do you automatically set the focus to a textbox when a web page loads?</a></p>
  
  <pre><code> &lt;asp:TextBox ID="tbSearchLastName" runat="server" style="float:right" CssClass="search" tabindex="1" meta:resourcekey="tbSearchLastNameResource" /&gt;
  
                          &lt;script type="text/javascript"&gt;
                              window.onload = function () {
                                  document.getElementById("tbSearchLastName").focus();
                              };
                          &lt;/script&gt;
  </code></pre>
  
  <p>I want the page focus to be on the textbox when the page loads but I am getting the error:</p>
  
  <p>"Unable to get value of the property 'focus': object is null or undefined"</p>
  
  <p>Thanks.</p>