Link to home
Start Free TrialLog in
Avatar of levelninesports
levelninesports

asked on

I would like to add a display characters option to password entries

Some windows password input boxes have a checkbox that allows you to see the characters you are entering into a password input.
It seems a pretty easy answer with javascript checkbox deciding whether to input in password style or text style.. but I am pretty weak at javascript
Avatar of TurboBorland
TurboBorland
Flag of United States of America image

You would have to use something that can change a value in the form.  Something like DOM manipulation in Javascript.
Simply change the type= from "password" to "text" when the checkbox is checked.
<html>
<script language="javascript">
function show() {
document.formname.pass.type = 'text';
}
</script>
<body>
<form name="formname" method="POST" action="">
Username:  <input type="text" value="" name="user" /><br />
Password:  <input type="password" value="" name="pass" /><br />
<input type="checkbox" name="change" onClick="show()" />Show Password<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Avatar of levelninesports
levelninesports

ASKER

That's pretty good.. now what do I have to do to have the input type switch back to password when they unclick?
ASKER CERTIFIED SOLUTION
Avatar of TurboBorland
TurboBorland
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial