Home >Web Front-end >HTML Tutorial >This is a text box. I want the text field to also implement this function. How to make _html/css_WEB-ITnose

This is a text box. I want the text field to also implement this function. How to make _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:25:221235browse

<input type="text" name="link" id="link" onfocus="javascript:if('请输入您的用户名'==this.value)this.value='';" onblur="javascript:if(''==this.value)this.value='请输入您的用户名'" value="请输入您的用户名" /> 


There is a default content and the color is gray. Then when the mouse is clicked in, the table will be empty. If the content is not modified and the mouse is moved away, it will become the default content. If it is modified, it will become the modified content. . .
4e0f8c4b890caac7500a2b508d656fbe40587128eee8df8f03d0b607fe983014
Find out how to write this text area.


Reply to discussion (solution)

<textarea  id="text"  onFocus="if(this.innerHTML=='请输入内容'){this.innerHTML=''}" onBlur="if(this.innerHTML==''){this.innerHTML='请输入内容'}">请输入内容</textarea> 

<textarea  id="text"  onFocus="if(this.innerHTML=='请输入内容'){this.innerHTML=''}" onBlur="if(this.innerHTML==''){this.innerHTML='请输入内容'}">请输入内容</textarea> 


Master, thank you.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn