<input type="text" value="请输入课程名称、课程介绍关键字" style="color: #aaa" id="search_word_input" />
<script>
var s=document.getElementById("search_word_input");
s.οnfοcus=function(){
if(this.value==this.defaultValue)
this.value=''
};
s.οnblur=function (){
if(/^\s*$/.test(this.value)){
this.value=this.defaultValue;
this.style.color='#aaa'
}
}
s.οnkeydοwn=function(){
this.style.color='#333'
}
</script>
input 默认设置值设置,单击后自动变为空
最新推荐文章于 2023-01-09 09:39:09 发布