JS去除空格格
来源:互联网 发布:淘宝达人发布帖子 编辑:程序博客网 时间:2024/05/16 19:32
SCRIPT LANGUAGE="JavaScript">
<!--
//出处:网上搜集
// Trim() , Ltrim() , RTrim()
String.prototype.Trim=function()
{
returnthis.replace(/(^\s*)|(\s*$)/g,"");
}
String.prototype.LTrim =function()
{
returnthis.replace(/(^\s*)/g,"");
}
String.prototype.RTrim =function()
{
returnthis.replace(/(\s*$)/g,"");
}
//-->
</SCRIPT>
<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=' 前后都是空格 ';">
<a href="http://www.yaoasnsi.com" target="_blank">访问yaosansi.com</a>
<!--
//出处:网上搜集
// Trim() , Ltrim() , RTrim()
String.prototype.Trim=function()
{
returnthis.replace(/(^\s*)|(\s*$)/g,"");
}
String.prototype.LTrim =function()
{
returnthis.replace(/(^\s*)/g,"");
}
String.prototype.RTrim =function()
{
returnthis.replace(/(\s*$)/g,"");
}
//-->
</SCRIPT>
<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=' 前后都是空格 ';">
<a href="http://www.yaoasnsi.com" target="_blank">访问yaosansi.com</a>
- JS去除空格格
- js 去除空字符串
- Js数组去除空值
- js去除数组中的空值,假值
- [转]js去除空格验证空字符和电话号码代码
- js数组中去除重复对象及去除空对象的方法
- php去除空值
- js去除空字符方法和一个解决json乱码的方法
- js 去除数组中的空值以及数组判断是否有重复数据
- 去除NSString中的空字符
- Java 去除数组空元素
- js 去除 HTML 标签
- js去除空格
- JS去除空格
- js 去除 html 标记
- js去除空格
- JS去除html标签
- JS去除空格
- 最近使用vector的一些心得
- 泛型
- 利用D3DQUERY实现简单的GPU计时器
- poj 2917 Diophantus of Alexandria
- FusionChartsFree免费的报表
- JS去除空格格
- Java注解
- JavaScript重定向
- Hyperic HQ 可视化工具插件 WMV
- 经验点滴
- 在Ubuntu安装完成后更改默认的语言LANG,出现Cannot set LC_CTYPE to default locale: No such file or directory错误的解决办法
- 一个简单makefile(指定obj文件位置)
- MYSQL添加新用户 MYSQL为用户创建数据库 MYSQL为新用户分配权限
- PDF转word(图片转word)简单方法