使用onblur和onfocus属性:
<input type="text" value="默认值" οnblur="if(this.value==''){this.value='默认值'}" οnfοcus="if(this.value=='默认值'){this.value=''}" />
使用onblur和onfocus属性:
<input type="text" value="默认值" οnblur="if(this.value==''){this.value='默认值'}" οnfοcus="if(this.value=='默认值'){this.value=''}" />
转载于:https://www.cnblogs.com/liuyueyingzi/p/3345762.html