onfocus onblur
<input type="text" name="" value="我是一个兵" id="test" />

<script type="text/javascript">
var test = document.getElementById("test");
test.onfocus
= function(){ if(this.value == this.defaultValue) this.value="";}
test.onblur
= function(){ this.value = this.value == 0 ? this.defaultValue : this.value;}
</script>

 

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2021-12-25
  • 2021-12-18
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2022-02-15
  • 2022-02-19
  • 2022-02-04
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案