javascript搜索框点击文字消失失焦时文本出现
2014-09-18 17:23
1021 查看
当获焦时,文本消失,失焦时文本出现
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <input id="text" type="text" value="点我就消失"/> <script> var oText=document.getElementById("text"); var onoff=true; oText.color="#000"; oText.onfocus=function(){ if(onoff){ this.value=""; this.color="red"; onoff=false; } } oText.onblur=function(){ if(this.value==''){ this.color="#000"; this.value="点我就消失"; onoff=true; } } </script> </body> </html>
您可能感兴趣的文章:
相关文章推荐
- javascript搜索框点击文字消失失焦时文本出现
- JavaScript实现文本框点击时文字消失,失去焦点时文字出现
- javascript实现点击文本出现文本编辑状态,移开后变成文本
- 兼容ie8的input点击消失,离开出现文字
- js实现input文本框点击时文字消失,失去焦点时文字出现
- 搜索提示框文字,鼠标点击,文字消失,鼠标点外面,文字出现
- 文本框点击时文字消失,失去焦点时文字出现
- 文本框点击时文字消失,失去焦点时文字出现
- jQuery实现文本域内提示文字,当鼠标点击进文本域后自动消失,文本域失去鼠标焦点后显示提示文字或显示用户输入的文字。
- 设计input搜索框提示文字点击消失的效果,提示文字与输入显示不同----->特别推荐
- 文本框点击时文字消失,失去焦点时文字出现!
- 搜索框点击文字消失、带背景
- ppt点击文字出现图片,再次点击消失
- 使用javascript控制密码框获取焦点时文字消失,失去焦点时文字出现
- asp.net搜索框提示文字点击消失的效果
- 设计input搜索框提示文字点击消失的效果
- js实现文本框中鼠标点击关键字消失,失去焦点关键字出现
- html代码一小段-------鼠标放上选中,鼠标点击,文字消失,鼠标离开文字又有了
- javascript实现网站顶部出现几秒后图片缓慢消失的效果
- 网页输入框默认文字出现与消失