title: Javascript .focus() not working
body: <p>I'm having trouble getting the javascript .focus() function to work. At this point, I'm really not sure why it's failing to execute. Could it have something to do with onload?</p>
  
  <p>This is my code: </p>
  
  <pre><code>var request_brochure = function()
  
  {
      var name = $("name").value;
      var email = $("email").value;
      var isValid = true;
  
      if(name == "")
      {
          $("name").focus();
          alert("Please fill in your name.");
          $("name").focus();
          isValid = false;
      }
      else if(email == "")
      {
          window.setTimeout(function(){$("email").focus();}, 100);
  
          alert("Please fill in your email. ");
          window.setTimeout(function(){$("email").focus();}, 100);
          isValid = false;
      }
  
      if(isValid)
      {
          $("form_b").submit();
          //$("brochure").innerHTML = "Request Submitted";
      }
  }
  
  window.onload = function () {   
      $("name").focus();
      $("submit1").onclick = request_brochure;
  
  }
  var $ = function (id) {
      return document.getElementById(id);
  }
  </code></pre>
  
  <p>Any help is appreciated </p>