js实现html的placeholder属性效果
来源:互联网 发布:java 报表工具 开源 编辑:程序博客网 时间:2024/06/06 07:34
如何通过js实现html的placeholder属性效果呢
我们需要这样做:
<!DOCTYPE html><html><head><meta charset="utf-8"><title></title><script>function bl(){var a=document.getElementById("inpt");if(a.value.length<=0){a.style.color="#999999";a.value="请输入姓名";}}function fo(){var a=document.getElementById("inpt");if(a.value=="请输入姓名"){a.style.color="black";a.value="";}}</script></head><body><input style="color: #999999;" value="请输入姓名" id="inpt" type="text" onblur="bl()" onfocus="fo()" /></body></html>
自己动手试试看吧!!!
1 0
- js实现html的placeholder属性效果
- 积跬步,聚小流-------js实现placeholder的效果
- 实现UITextView的placeholder效果
- 实现placeholder属性的UITextView
- 实现placeholder属性的UITextView
- 纯CSS实现select的placeholder效果
- 关于表单用js如何实现占位符placeholder的效果
- ios UITextView的placeholder属性实现
- textView实现placeholder效果
- HTML 5 <input> placeholder 属性
- HTML 5 <input> placeholder 属性
- HTML 5 <input> placeholder 属性
- HTML 5 <input> placeholder 属性
- HTML 5 <input> placeholder 属性
- HTML 5 <input> placeholder 属性
- js 实现html滚动效果
- js+html实现遮罩层效果
- HTML的placeholder标签
- java--三目运算符 类型自动提升
- 数据结构、算法与应用 (C++描述) 第二版 1.10
- Could not load the following font :pdfFontName : STSong-Light问题
- web技术概论第六周作业
- NodeJs开发微信公众号
- js实现html的placeholder属性效果
- 【Tomcat】eclipse如何安装tomcat插件
- 警报:XcodeGhost已扩散至第三方框架
- NSString+NSMutableString+NSValue+NSAraay用法汇总
- 关于C语言的fprintf与fwrite使用区别
- jpush 推送
- Android系统移植与调试之------->如何修改Android系统默认显示【开发者选项】并默认打开【USB调试】和【未知来源】开关
- EditPlus配置代码快速行注释和取消行注释
- [Unity热更新]unity5中的assetbundle