title: an unordered list from Array items using innerHTML in Javascript
body: <p>I am trying to add a bulleted list to the page after the user enters 'exit' into a prompt; the list should not include the term 'exit'. I was able to get the list in full using document.write but this included the 'exit' and got rid of my page formatting. I am pretty sure I need to use innerHTML, but when I do this all I get is the page without any of the array items. Any help is greatly appreciated.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;img src="http://profperry.com/Classes20/JavaScript/lordoftherings.png" /&gt;
      &lt;title&gt;Javascript Test&lt;/title&gt;
      &lt;script&gt;
      function askMe() {
          var fav_characterList = new Array();
          i = 0;
          var fav_character = "";
  
          while(fav_character != 'exit'){
  
              fav_character = prompt("Who's your favorite Lord of the Rings character\n\n Enter 'exit' to stop prompting", "");
              fav_characterList[i] = fav_character;
  
              i++;
          } 
  
          n = (fav_characterList.length);
          for(i = 0; i &lt;= (n-1); i++){
              var list = fav_characterList[i];
              var MyList = getElementById('results');
              MyList.innerHTML = "&lt;li&gt;"+list+"&lt;/li&gt;";
  
  
          }
  
  
      } 
  
  
  
  
  
  
  
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body onload="askMe()"&gt;
      &lt;ul&gt;
  
          &lt;div id="results"&gt;
  
  
          &lt;/div&gt;
      &lt;/ul&gt;
  
  
          &lt;br/&gt;
          &lt;br/&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p></p>