为什么下面的javascript判断不起作用?真是不明白。
  <html>  
  <head>  
  <title> 为什么错误? </title>  
  <script   language= "javascript ">  
 function   chkreg(regf) 
 { 
 	if   (trim(regf.txt_pwdQuestion.value)== " ") 
 	{ 
 	alert( "密码提示问题不能为空! "); 
 	regf.txt_pwdQuestion.focus(); 
 	return   false;	 
 	} 
 	regf.submit(); 
 } 
  </script>  
  </head>  
  <body>  
  <table   width= "748 "   height= "50 "   border= "2 "   cellpadding= "1 "   cellspacing= "2 "   bordercolor= "#EBE9ED ">  
  <form   name= "jmform1 "   id= "jmform1 "   method= "post "   action= "checkUser_Save.asp "   onsubmit= "return   chkreg(jmform1); ">  
           <tr>  
              <td   align= "right "> 取回密码问题: </td>  
              <td>  <input   name= "txt_pwdQuestion "   type= "text "   id= "txt_pwdQuestion "   size= "30 "   maxlength= "18 "   class= "reg "   value= " ">  
                    <span   class= "style11 "> * </span>  <span   class= "STYLE13 "> (用于忘记密码取回密码) </span>  </td>  
        </tr>  
           <tr>  
              <td   align= "right "> 取回密码答复: </td>  
              <td>  <input   name= "txt_pwdAnswer "   type= "text "   id= "txt_pwdAnswer "   size= "30 "   maxlength= "18 "   class= "reg "   value= "luodiong ">  
        </tr>          
        <tr>  
              <td   height= "20 "   align= "right ">   </td>  
              <td   height= "20 ">  <input   type= "submit "   name= "Submit "   value= "提交 "   class= "reg1 " "/>  </td>  
        </tr>  
     </form>  
  </table>  
  </body>  
  </html>
------解决方案--------------------trim()函数定义了么?
------解决方案--------------------你是不是少写了document!!! 
 应该是doucment.regf.txt_pwdQuestion.value
------解决方案--------------------当初我也犯过晕,为啥asp有trim函数,而javascript没有呢,还得自己定义! 
 呵呵
------解决方案--------------------js里确实没有trim这个函数!
------解决方案--------------------在 <script language= "javascript "> 后加上这句: 
 function   String.prototype.Trim()   {return   this.replace(/(^\s*)|(\s*$)/g, " ");}   
 使用方法: 
 regf.txt_pwdQuestion.value.Trim()