点评:常用input文本框内容自动垂直居中同时实现默认提示文字单击为空的效果,想必有很多的朋友都不会吧,下面为大家详细介绍下具体的实现方法,感兴趣的朋友可以参考下哈
三个功能: 53hHTML5中文学习网 - HTML5先行者学习网53hHTML5中文学习网 - HTML5先行者学习网1、内容自动垂直居中
53hHTML5中文学习网 - HTML5先行者学习网2、默认提示文字显示灰色
53hHTML5中文学习网 - HTML5先行者学习网3、单击后变为空
53hHTML5中文学习网 - HTML5先行者学习网 53hHTML5中文学习网 - HTML5先行者学习网
<input type="text" name="wd1" id="qy_1" maxlength="100" style="color:gray;width:199px;height:30px;line-height:30px;" autocomplete="off" value="请输入企业名称" style="color:gray;" onfocus="javascript:if(this.value == '请输入企业名称') this.value = ''; this.style.color='gray';" onblur="if(this.value == '') {this.value = '请输入企业名称'; this.style.color = 'gray';}"> 53hHTML5中文学习网 - HTML5先行者学习网