title: How can I call multiple window.location.href in one javascript function?
body: <p>I am trying to parse multiple href's with one JavaScript function. When I unremark the alert, it works fine. I'm assuming it has something to do with timing but I'm not sure the best way to do this.</p>
  
  <p>I have tried the sleep command to add some sort of pause but that did not work as I expected it.</p>
  
  <pre><code>function pName(selectObject) {
      var x = selectObject.value;
      var y = selectObject.value.length;
      if (x === undefined) {
          x = 97;
      }
      str = '1st page here=' + "'" + x + "'";
      //alert(str);
      window.location.href = str;
  
      if (y == 0) {
          nxt = '2nd page - 1';
      } else {
          nxt = '2nd page - 2';
      }
      //alert(nxt);
      window.location.href = nxt;
  }
  </code></pre>