title: How to get data from HTML form and use it in HTML canvas script
body: <p>I'm doing a game using HTML canvas and I put on the HTML page several input boxes inside a form in which the user is to put the level's password so he can go on to the next one. But the problem is that I cannot figure out how to get the input box's value and have the script enter the level if the correct password is put and do nothing if it isn't correct of nothing is in the box. (the script is in an external JavaScript file) I tried the 'normal' way (the <code>document.getElementById("...").value</code> thing in a variable then manipulating it as needed) but obviously it didn't work. </p>
  
  <p>Below is the form part of the HTML page in case it helps but there really isn't anything in the script that has to do with it.</p>
  
  <pre><code>&lt;form id="passes"&gt;  
  Level 2 password: &lt;input type="text" id="level2pass" /&gt;&lt;br /&gt;  
  Level 3 password: &lt;input type="text" id="level3pass" /&gt;&lt;br /&gt;  
  Level 4 password: &lt;input type="text" id="level4pass" /&gt;&lt;br /&gt;  
  Level 5 password: &lt;input type="text" id="level5pass" /&gt;&lt;br /&gt;  
  Bonus level password: &lt;input type="text" id="bonuslevelpass" /&gt;  
  &lt;/form&gt;
  </code></pre>
  
  <p>If there isn't any plausible way, could there be another way to integrate passwords into the game in such a way that I can easily (or not so easily :D) get the value of the input and use it in the canvas?</p>