Summary: When you click the mouse in the input box, the prompt in the input box disappears, and the mouse moves away. The prompt in the input box appears.

Source: Internet
Author: User

Summary: When you click the mouse in the input box, the prompt in the input box disappears, and the mouse moves away. The prompt in the input box appears.

Question example:

When the mouse clicks in the input box, the prompt in the input box disappears, and the mouse moves away. The prompt in the input box appears. :



The procedure is as follows:

<Input type = "text" name = "name" id = "name" class = "ind_cont_input ind_cont_inputioce1" onfocus = "if (value = 'enter 2-5 Chinese name ') {value = ''}" onblur = "if (value = '') {value = 'enter 2-5 Chinese name'} "value =" enter 2-5 Chinese names ">

<Input type = "text" name = "tel" id = "tel" class = "ind_cont_input ind_cont_inputioce2 ind_cont_inputboder1" value = "Enter your phone number" onfocus = "if (value = "= 'enter your phone ') {value = ''}" onblur = "if (value ='') {value = 'enter your phone number '} ">

Note that the onblur and onfocus attributes of input are used. In addition, there is a simple if judgment. It is very convenient and practical.


Demo address: http://www.ya-jing.cn

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.