js搜索输入关键词
function getInput(val,a){ var id = 'ser-key'; if(a=='focus'){ document.getElementById(id).value=''; } if(a=='blur'){ if(val==''){ document.getElementById(id).value= "请输入VIP卡号或手机号码查询"; }else{ document.getElementById(id).value= val; } } }
<input name="keyword" type="text" class="inp_a" id="ser-key" onfocus="getInput(this.value,'focus')" onblur="getInput(this.value,'blur')" value="请输入VIP卡号或手机号码查询" size="40" />