js去掉所有空格

<script>

String.prototype.trim = function () {
            return this.replace(/(^\s*)|(\s*$)/g, "");
        }
        function $G(id) {
            return document.getElementById(id);
        }

  

 

function spaceTrim()

{

  var strValue=$G("id").value.trim();

}

</script>

posted @ 2013-11-04 11:28  周佳洪  阅读(477)  评论(0编辑  收藏  举报