Solved

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

Posted on 2008-09-30
3
193 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:levelninesports
  • 2
3 Comments
 
LVL 4

Expert Comment

by:TurboBorland
ID: 22611509
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>
0
 

Author Comment

by:levelninesports
ID: 22621122
That's pretty good.. now what do I have to do to have the input type switch back to password when they unclick?
0
 
LVL 4

Accepted Solution

by:
TurboBorland earned 500 total points
ID: 22621681
Add an if/else statement:
<html>
<script language="javascript">
function show() {
  if (document.formname.change.checked == true) {
    document.formname.pass.type = 'text';
  } else {
    document.formname.pass.type= 'password';
  }
}
</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>
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sharepoint to FTP? 3 63
Error viewing ASP page 12 149
Example unit tests with AngularJS 3 40
Need some help with powershell script 5 35
Using Quotation Marks in PHP This question (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28217211.html) seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now