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
Release: 2016-06-24 12:25:22
Original
1213 people have browsed it

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


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. . .

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> 
Copy after login
Copy after login

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


Master, thank you.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template