title: JavaScript infinite loop upon clicking "Next" button
body: <p>Been a while since I last did JavaScript, but school forced us into a JavaScript project. So here I am, making a simple quiz game. Coming along quite nicely, yet I'm experiencing issues with probably something terribly simple.</p>
  
  <pre><code>var useranswers = new Array();
  var imgArray = new Array();
  var answered = 0;
  var currentQuestion = 0;
  
  function renderQuizViaArray() 
  {
      document.writeln('&lt;h1&gt;' + questions[currentQuestion] + '&lt;/h1&gt;');
  
      for(i=0; i &lt; choices[currentQuestion].length; i++)
      {
          document.writeln('&lt;input type="radio" name="answer_' + currentQuestion + '" value="1" id="answer_' + currentQuestion + '_' + i + '" class="question_' + currentQuestion + '" onclick="submitAnswer(' + currentQuestion + ', this, \'question_' + currentQuestion + '\', \'label_' + currentQuestion + '_' + i + '\')" /&gt;&lt;label id="label_' + currentQuestion + '_' + i + '" for="answer_' + currentQuestion + '_' + i + '"&gt; ' + choices[currentQuestion][i] + '&lt;/label&gt;&lt;br /&gt;');
      }
  
      document.write('&lt;input type="submit" value="NEXT" onclick="nextQuestion()" /&gt;');
  }
  
  function nextQuestion()
  {
      currentQuestion++;
      renderQuizViaArray();
  }
  </code></pre>
  
  <p>Whenever I click the "NEXT" button, it loads the second question (Element[1]) from an Array as well as the answers of another Array onto the screen. But the page remains in an infinite loading state and Firebug gives the message: "Reload to activate window console"</p>
  
  <p>Anyone?</p>