当前位置:主页 > 查看内容

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

发布时间:2021-05-08 00:00| 位朋友查看

简介:可以用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 2p……
可以用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="请输入你想要输入的内容"/>

原文链接:https://m.jb51.net/web/197054.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐