This code below works in all web browsers except IE:
<input type="text" name="passwordLogin" value="Password" onfocus="if(this.value=='Password'){this.value=''; this.type='password'};" onblur="if(this.value==''){this.value='Password'; this.type='text'};" size="25" />
How can I fix it for IE?
I did some changes, but it still has an error.
I want it to work like this like here:
<input type="text" name="usernameLogin" value="Email" onfocus="if(this.value=='Email'){this.value=''};" onblur="if(this.value==''){this.value='Email'};" size="25" />
if I don't enter anything it will put the value back.
So I tried this:
<td colspan="2" id="passwordLoginTd">
     <input id="passwordLoginInput1" type="text" name="passwordLogin" value="Password" onfocus="passwordFocus()" size="25" />
     <input id="passwordLoginInput2" style="display: none;" type="password" name="passwordLogin" value="" onblur="passwordBlur()" size="25" />
    </td>
    <script type="text/javascript">
    //<![CDATA[
    
     passwordElement1 = document.getElementById('passwordLoginInput1');
     passwordElement2 = document.getElementById('passwordLoginInput2');
    
     function passwordFocus() {
     
      passwordElement1.style.display = "none";
      passwordElement2.style.display = "inline";
      passwordElement2.focus();
     
     }
     
     function passwordBlur() {
     
      if(passwordElement2.value=='') {
      
       passwordElement2.style.display = "none";
       passwordElement1.style.display = "inline";
       passwordElement1.focus();
      
      }
     
     }
    
    //]]>
    </script>
as you can see the blur does not work.
Finally I got it, I needed to remove:
passwordElement1.focus();
 
     
     
     
     
     
    