title: How to launch a pop up on the correct answering of a text field in Javascript
body: <p>I'm creating an online game wherein players have to answer questions while closing pop ups. If they answer incorrectly, they are greeted with an alert telling them if they are incorrect. If they answer correctly, they receive a pop up to the next question. I have the incorrect functionality working, but I can't get the pop up if correct bit working. What am I doing wrong? Note that I'm very new to Javascript, so this is almost entirely the code of others.</p>
  
  <pre><code>            function Start1(URL1, WIDTH, HEIGHT) {
              windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
              preview = window.open(URL1, "", windowprops);
          }
  
  
          function doPopup1() {
              url1 = "focus.html";
              width = 500;  // width of window in pixels
              height = 500; // height of window in pixels
              delay = 5;    // time in seconds before popup opens
              timer = setInterval("Start1(url1, width, height)", delay*1000);
          } 
  
          function doPopup2() {
              url2 = "q1.html";
              width = 500;  // width of window in pixels
              height = 500; // height of window in pixels
              delay = 1;    // time in seconds before popup opens
              timer = setTimeout("Start1(url2, width, height)", delay*1000);
          }        
  
  
  function checkAnswer (form){
          var Answer = form.Answer.value;
          if (Answer == "2"){
              doPopup2();
          }
          else{
              alert ("Incorrect")
          }
      }
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>&lt;body OnLoad="doPopup1();"&gt;
  </code></pre>
  
  <p>And then a basic HTML table, but the important part is this:</p>
  
  <pre><code>&lt;input type="submit" name="Submit" value="Submit" onClick="checkAnswer(this.form)" /&gt;
  </code></pre>