没有现成的,自己编一个把function Trim(x){
while((x.length>0) && (x.charAt(0)==' '))
x = x.substring(1 , x.length);
while((x.length>0) && (x.charAt(x.length-1)==' '))
x = x.substring(0, x.length-1);
return x;
}
while((x.length>0) && (x.charAt(0)==' '))
x = x.substring(1 , x.length);
while((x.length>0) && (x.charAt(x.length-1)==' '))
x = x.substring(0, x.length-1);
return x;
}
text = text.replace (/\s/ig,'');