Search box with search hint Click vanishing Code instance:
Search box Everyone must be unfamiliar, because at any time can be used, more humane search box has such a effect, the default is a search hint, click on the search box, the content disappears, the following code example to introduce how to achieve this function.
The code is as follows:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.51texiao.cn/" /><title>Ant Tribe</title><Scripttype= "Text/javascript">window.onload=function(){ varkeyword=document.getElementById ("keyword"); Keyword.onfocus=function(){ if( This. Value=="Please enter a keyword"){ This. Value=""; }} Keyword.onblur=function(){ if( This. Value==""){ This. Value="Please enter a keyword"; } }}</Script> </Head> <Body> <inputtype= "text"value= "Please enter keywords"ID= "keyword"/><inputtype= "button"value= "click submit"ID= "Tijiao"/></Body> </HTML>
The above code to achieve our requirements, click on the text box can delete the prompt content, the code is relatively simple here is not more introduction.
The original address is: http://www.51texiao.cn/HTML5jiaocheng/2015/0613/4142.html
The original address is: http://www.softwhy.com/
Search box with search hint Click Vanishing Code instance