javascript 去除字符串中空格的函数

(1) 用display隐藏显示表格时不能在TR外面使用DIV,但是可以使用TBODY,


(2) javascript 去除字符串中空格的函数
 
  1. // 去除左空格   
  2. function ltrim(s){
  3.     return s.replace( /^\s*/, "");
  4. }
  5. // 去右空格;   
  6. function rtrim(s){
  7.     return s.replace( /\s*$/, "");
  8. }
  9. // 去左右空格;   
  10. function trim(s){
  11.     return rtrim(ltrim(s));
  12. }

你可能感兴趣的:(JavaScript)