Enter the setting and clearing of "prompt text" in the text box, and empty the text box.

Source: Internet
Author: User

Enter the setting and clearing of "prompt text" in the text box, and empty the text box.

<1>

<Html xmlns = "http://www.w3.org/1999/xhtml"> 



In the input text box in html, there is a text prompt in the beginning. When you click it, the text disappears. How can I set it?

Use the onfocus event to check the current value. If it is the default value, leave the value Attribute blank. For example:
<Input type = "text" value = "Enter the content" onfocus = "javascript: if (this. value = 'Enter the content') this. value = '';">
I have already provided the implementation method of the placeholder attribute of html5. what I have provided is the JS solution.

Set prompt text settings in the vb text box

Private Sub Form_Load ()
Text1.Text = "Enter your information! "
End Sub

Private Sub text=click ()
Text1.Text = ""
End Sub

If the number of controls in your form is large, and the text box control is not the first time to get the focus, you can also do this!

Private Sub text=gotfocus ()
Text1.Text = ""
End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.