日期:2014-05-16  浏览次数:20352 次

javascript trim的实现
<script  type="text/javascript">
String.prototype.trim = function(){

    return this.replace(/(?:^\s*)|(?:\s*$)/g,'');

}
var test = '    liuuxiosbo      ';
alert(test.trim().length);
</script>
?