将字符转换为星号

发布于 2024-08-09 21:51:02 字数 223 浏览 2 评论 0原文

我参加了 Web 开发人员/HTML 开发人员职位的面试。在那里他问了我一个问题,问题是......有一个文本框和一个按钮,当我在文本框中输入任何字符时,一旦现在输入字符,它必须转换为星号符号(即“*”)单击按钮,所有符号都必须转换回弹出窗口中的字符。我无法回答这个问题,但我真的想知道这个问题的解决方案。我认为你可以使用 javascript、html 或 jquery,我不确定到底使用哪种语言。plzzzzz 建议我解决方案。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

情独悲 2024-08-16 21:51:02

大多数文本框都有“密码”模式,在该模式下您看不到输入的文本。只需单击按钮即可切换模式。

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.

メ斷腸人バ 2024-08-16 21:51:02

尝试使用带有密码选项的文本框或密码输入框。当然,如果您更具体地了解您正在使用的语言和平台,那么为您提供更具体的帮助会更容易。

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.

娇女薄笑 2024-08-16 21:51:02

在 Swing 中,您可以使用 JpasswordField 来应对这种情况。如果您正在使用 Swing,那么您可以使用它。当用户单击按钮时,只需执行 jpassfld.setEchoChar(0) 即可显示原始文本。

但取决于您使用的 GUI 工具包。上面是一个 Swing 的例子

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

说好的呢 2024-08-16 21:51:02

不能只使用TextBox的PasswordChar吗?

在 C# 中,要设置密码字符:

TextBox1.PasswordChar = '*';

要删除按钮上的密码字符,请单击:

TextBox1.PasswordChar = (char)0;

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;
数理化全能战士 2024-08-16 21:51:02

根据编程语言和编辑器的不同,文本框通常具有使其行为类似于密码输入字段的属性。只需连接您的按钮即可切换该属性。

很抱歉这个笼统的答案,但你的问题非常模糊。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文