Js 实现trim方法

<SCRIPT LANGUAGE="JavaScript">
<!--
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>

 

posted @ 2012-04-13 09:00  cotty  阅读(339)  评论(0编辑  收藏  举报