var str;
str.replace(/\t/g,"");//去掉所有制表符
str.replace(/(^\t*)|(\t*$)/g,"");//去掉首尾制表符

补充,换行的用如下代码替换:

var str;
str.replace(/\n/g,"");
str.replace(/\r/g,"");

Related Posts: JavaScript 去掉全部制表符和首尾制表符以及换行的代码示例 :