如何去掉空格?
<html:password   property= "newpsd "   size= "12 "   maxlength= "10 "   />  
  <script   language= "javascript ">  
 function   Judge()   { 
 a   =   document.getElementById( "newpsd ").value; 
 } </script>  
 如何把a的空格去掉? 
 我试了: 
 a   =   document.getElementById( "newpsd ").value.trim(); 
 a   =   Trim(document.getElementById( "newpsd ").value); 
 都不行 
 哪位高手指点一下?
------解决方案--------------------js中的trim只有自己写,他是不提供的; 
 function  trim(str) 
 { 
 return  str.replace(/^\s*(.*?)[\s\n]*$/g,   '$1 '); 
 }
------解决方案--------------------呵呵!自己写吧!不然用vbscript. 
 js就这样吧: 
 String.prototype.Trim = function()  
 {  
 return this.replace(/(^\s*)|(\s*$)/g,  " ");  
 }  
 String.prototype.LTrim = function()  
 {  
 return this.replace(/(^\s*)/g,  " ");  
 }  
 String.prototype.Rtrim = function()  
 {  
 return this.replace(/(\s*$)/g,  " ");  
 }  
  <script language=javascript>   
 String.prototype.Trim = function()  
 {  
 return this.replace(/(^\s*)|(\s*$)/g,  " ");  
 }     
 var s =  " leading and trailing spaces  ";    
 window.alert(s +  " ( " + s.length +  ") ");    
 s = s.Trim();    
 window.alert(s +  " ( " + s.length +  ") ");    
  </script>