title: focus on textbox using javascript
body: <p>I would like to focus on textbox according to their arrangement.... my problem is according to my code it direct focus on third textbox.. but i would like to focus according to arrangement of texbox... example if first textbox is blank then it will focus on first textbox, currently it is focusing on third textbox... </p>
  
  <pre><code>&lt;input type="text" id="txtFirst"/&gt;
             &lt;input type="text" id="txtSecond"/&gt;
              &lt;input type="text" id="txtThird"/&gt;
              &lt;input type="button" onclick="check()" value="Check" /&gt;
              &lt;script&gt;
                  function check() {
                      var err = "";
                      var first = document.getElementById("txtFirst");
                      var second = document.getElementById("txtSecond");
                      var third = document.getElementById("txtThird");
                      if (first.value == "") {
                          first.focus();
                          err = err + "enter the first value";
                      } if (second.value == "") {
                          second.focus();
                          err = err + "enter the second value";
                      } if (third.value == "") {
                          third.focus();
                          err = err + "enter the third value";
                      } }
                  &lt;/script&gt;
  </code></pre>