一、

(1)TextBox获取焦点清空文本,失去焦点回复文本

<input type="text"

onblur="if(this.value.replace(/ /ig,'')=='')this.value=this.defaultValue" />

 

(2)replace(/ /ig,'')

js的replace方法将字符串中的&nbsp;全部替换为空字符串

<script language="javascript">
var test="this &nbsp; is &nbsp; a test";
test=test.replace(/&nbsp;/ig, "");
alert(test);
</script>

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-12-29
  • 2021-12-19
  • 2021-12-19
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案