文档库 最新最全的文档下载
当前位置:文档库 › html中实现文本框出现提示功能的多种方法

html中实现文本框出现提示功能的多种方法

html中实现文本框出现提示功能的多种方法
html中实现文本框出现提示功能的多种方法

可以用html5中的属性< input =text placeholder=你想输入的内容>

也可以用js做到加css样式

代码如下:

<style type=text/css>

.in_search {

border:1 none;

color:#999999;

float:left;

font-size:14px;

height:18px;

line-height:18px;

margin:3px 2px;

width:253px;

}

</style>

<input name=q class=in_search onfocus=if(this.value=='请输入你想要输入的内容'){this.value='';} onblur=if(this.value==''){this.value='请输入你想要输入的内容';} type=text value=请输入你想要输入的内容/>

相关文档