Toggle label element in javascript
<p>Hello everybody I've recently asked <a href="http://stackoverflow.com/questions/1907006/replace-input-with-javascript">this question</a> and I've given up with the 'replace input idea'. Instead I've decided to try another approach.. </p>

<p>I've made my password field background transparent and I placed <code>&lt;label&gt;</code> element "behind" the password input, so that it appears to be part of the password field. Now I wrote a standard function for toggling element like this :</p>

<pre><code>function togglePassword(obj) {
        var el = document.getElementById(obj);
        if ( el.style.display != 'none' ) {
         el.style.display = 'none';
        }
        else {
         el.style.display = '';
        }
       }
</code></pre>

<p>I trigger this function onforus and onblur from password field so that label disappears when the password field is focused but I have problems with onblur, because after I type password and hit TAB on the which takes me to login submit button then the <code>&lt;label&gt;</code> element appears with password value again and its mixed with typed password. <img src="http://i49.tinypic.com/23s7ypc.png" alt="image"> Here is the image of that, so I tried to come up with something new.</p>

<pre><code>function togglePassword(obj) {
          var el = document.getElementById(obj);
                        var input_el = document.getElementById('password_field');
                if(input_el.value.length &gt; 0)
                            {
                                el.style.display = 'none';
                            }
                           else {
                              if ( el.style.display != 'none' ) {
         el.style.display = 'none';
            }
            else {
             el.style.display = '';
            }
           }
                               }
</code></pre>

<p>Unfortunately, this code doesn't work .. can someone point to me where did I made mistake? So this second code should check whether password field is emtpy or not, if its not empty then continue to toogle if it is don't toggle just hide the password value. Help :D thank you</p>
