title: Change input type with javascript and chechbox, how to?
body: <p>I would like to create a registration form with hide-able and revealable password input. I tried this (JS):</p>
  
  <pre><code>function showhide(melyik,hol) {
      var melyiket = document.getElementById(melyik);
      var melyikkel = document.getElementById(hol);
  
      if (melyikkel.value == '1') {
          document.getElementById(melyikkel).value='0';   
          document.getElementById(melyiket).type='password'; 
      } else {
          document.getElementById(melyikkel).value='1';   
          document.getElementById(melyiket).type='text';                 
      } 
  }
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>&lt;div style="margin-top:20px;"&gt;
      &lt;p&gt;SQL host: &lt;input type="text" name="sql_host" value="localhost"/&gt;&lt;/p&gt;
      &lt;p&gt;SQL adatbázis: &lt;input type="text" name="sql_db"/&gt;&lt;/p&gt;
      &lt;p&gt;SQL felhasználó: &lt;input type="text" name="sql_user"/&gt;&lt;/p&gt;
      &lt;p&gt;SQL jelszó: &lt;input type="text" name="sql_password" id="sql_password"/&gt;
          &lt;input type="checkbox" name="show_password_1" id="show_password_1" value="0" onclick="showhide('sql_password','show_password_1');"&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to do this:
  If checkbox is checked the password input type is text. When not checked the password type is password... I wrote this JavaScript, but not working. :-(</p>