码迷,mamicode.com
首页 > 其他好文 > 详细

input提示字在有焦点消失或输入改变时消失

时间:2014-07-25 14:06:51      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:style   color   c   问题   html   div   line   htm   

一:获取焦点时 提示字消失
<input type="text" name="textfield" value="这里是提示内容" onclick="if(value==defaultValue){value=‘‘;this.style.color=‘#000‘}" onBlur="if(!value){value=defaultValue;this.style.color=‘#999‘}" />
 
二:修改文字时 提示字消失(但是placeholder有兼容性的问题)
<input class="text" type="email" name="email" spellcheck="false" placeholder="邮 箱" autofocus >
<input class="text" type="password" name="password" placeholder="密 码" >
<input class="button" type="submit" value="登 录" >

input提示字在有焦点消失或输入改变时消失,布布扣,bubuko.com

input提示字在有焦点消失或输入改变时消失

标签:style   color   c   问题   html   div   line   htm   

原文地址:http://www.cnblogs.com/liujinyu/p/3867553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!