views:

111

answers:

5

Hi, i had been to an interview for the post of webdeveloper/HTML developer . There he asked me a question, the ques was.... there is a textbox and a button when i enter any character into the textbox it must be converted into a asterisk sign(i.e "*")once the characters are entered now on clicking the button all the signs must be converted back into characters in a pop up.i was unable to answer this question,but i really want to know the solution for this. i think u can use javascript ,html or jquery for this i am not sure about which language is exactly used .plzzzzz suggest me the solution.

+3  A: 

Most text boxes have a "password" mode in which you can't see the text that is entered. Just toggle the mode by clicking on the button.

Aaron Digulla
+1  A: 

Try using a textbox with a Password option, or a Password input box. Of course it would be easier to give you more specific help if you were more specific about the language and platform you are using.

AnthonyWJones
+1  A: 

In Swing you have a JpasswordField for such cases. If you are using Swing then you can use it. When the user clicks in the button just do jpassfld.setEchoChar(0) which will show the original text.

But depends on what GUI toolkit you are using. Above ws an example with Swing

Suraj Chandran
isn't that example using Swing?
quack quixote
yes. it isusign swing :)
Suraj Chandran
A: 

Depending on the programming language and editor, usually a text box has a property that makes it behave like a password entry field. Simply connect your button to toggle that property.

Sorry for that generic answer, but your question is very vague.

brandstaetter
+1  A: 

Can you not just use the PasswordChar of the TextBox?

In C#, to set the PasswordChar:

TextBox1.PasswordChar = '*';

To remove the PasswordChar on the button click:

TextBox1.PasswordChar = (char)0;
GenericTypeTea
Thanks to whoever just bumped me over the 2k mark!
GenericTypeTea