开发者

Conversion of a character to asterisk

开发者 https://www.devze.com 2022-12-09 22:43 出处:网络
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 buttonwhen i enter any character into the textbox it mu

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开发者_如何学C can use javascript ,html or jquery for this i am not sure about which language is exactly used .plzzzzz suggest me the solution.


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.


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.


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


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;


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号