Changing password field to text with checkbox - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Checkbox

Description

Changing password field to text with checkbox

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
    function changeType()//  w w w  .  j a  v  a 2  s . c  om
    {
        document.myform.txt.type=(document.myform.option.value=(document.myform.option.value==1)?'-1':'1')=='1'?'text':'password';
    }

      </script> 
   </head> 
   <body> 
      <form name="myform"> 
         <input type="text" name="txt"> 
         <input type="checkbox" name="option" value="1" onchange="changeType()"> 
      </form>  
   </body>
</html>

Related Tutorials