js去除空格 |
||
---|---|---|
作者:佚名 更新日期:2012年06月18日 点击: | ||
str为要去除空格的字符串:
去除所有空格:
去除两头空格:
去除左空格:
去除右空格:
<SCRIPT LANGUAGE="JavaScript"> <input type="text" value=" 前后都是空格 " id="space"> <input type="button" value="去前后空格" onclick="javascript:document.getElementById('space').value=document.getElementById('space').value.Trim();document.getElementById('space').select();"> <input type="button" value="去前空格" onclick="javascript:document.getElementById('space').value=document.getElementById('space').value.LTrim();document.getElementById('space').select();"> <input type="button" value="去后空格" onclick="javascript:document.getElementById('space').value=document.getElementById('space').value.RTrim();document.getElementById('space').select();"> <input type="button" value="还原" onclick="javascript:document.getElementById('space').value=' 前后都是空格 ';">
|
||
js,javascript,js去除空格,javascript去除空格,YaDong网,徐亚东,亚东网 | ||
上一篇:只能输入数字, 正则限制input框只能输入数字,英文等 | ||
下一篇:有道身份证查询接口API |
您当前位置:YaDong网 >> 一些日志 >> Web前端 >> 浏览文章