Input how to clear the default value _ form effects

Source: Internet
Author: User
<input name= "username" type= "text" value= "name Name.last" "Size=" "maxlength=" "onfocus=" "this.value=" " >
Then if I move the mouse again, the default value, and when I entered, then do not appear the default value, how to deal with it?
<input name= "username" type= "text" value= "name Name.last" "Size=" "maxlength=" onfocus= "value=" "onblur=" if (!value) Value=defaultvalue ">
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]


This seems to be still some problems, when I entered the mouse will not revert to the original default value, but if I want to modify my input, it will not. The mouse point up, input was emptied
<input type= "text" onblur= "Showsearch (this,1)" onfocus= "Showsearch (This)" Name= "KeyWord" value= "Enter keyword for search"/> <script> function Showsearch (obj,type) {if (type) {if (obj.value== ") obj.value=" Enter keywords for search "; }else{if (obj.value== "Enter keyword for search") obj.value= ""; }} </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

And the moderator's only change:
<input name= "username" type= "text" value= "A/name.last name "Size=" maxlength= "onfocus=" if (value==defaultvalue) value= ' "onblur=" if (!value) value=defaultvalue "> </ textarea>
[ CTRL + A All SELECT Note: If you need to introduce external JS need to refresh to perform]

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.