function CheckFormEn(FormName){
	//校验表单
	//自定义属性 最大长度maxLength;格式符formatString;最小长度minLength;字符域inString;不包含字符域exString;焦点对象focusObject;标题Caption;重复对象repeatObject;自定义错误消息errMessage
    FormObj=document.getElementById(FormName)
    for (index=0;index<FormObj.elements.length;index++){
		SubName=FormObj.elements[index].name
	        SubObj=FormObj.elements[index]
	        if(typeof(SubObj)=='object'){
			   //得到焦点对象(即出错后得到焦点的对象)
			   focusObj=eval(SubObj.focusObject)
			   if(focusObj){
			      if(SubObj.focusObject=='this'){
				     focusObj=SubObj
				  }
               }
			   else{
			      focusObj=SubObj
			   }
			   //得到Caption属性
			   if(SubObj.Caption){
			      Caption=SubObj.Caption
			   }
			   else{
			      Caption=SubName
			   }
			   //得到errMsg属性
			   if(SubObj.errMessage){
			      errMsg=Trim(SubObj.errMessage)
			   }
			   else{
			      errMsg=''
			   }
		 if(Trim(SubObj.value)!=''&& SubObj.value!=null && SubObj.value.toUpperCase()!='NULL'){	
			   //判断最小长度
	           if(!isNaN(SubObj.minLength)){
		          if(Trim(SubObj.value).length<SubObj.minLength){
			         alert('The '+ Caption + 'not less than '+ SubObj.minLength +' characters');
					 focusObj.focus();
					 return false;
			      }
		       }
			   //判断最大长度
	           if(!isNaN(SubObj.maxLength)){
		          if((Trim(SubObj.value).length>SubObj.maxLength) && (SubObj.maxLength>0)){
			         alert('The ' + Caption + ' not more than '+SubObj.maxLength+' characters');
					 focusObj.focus();
					 return false;
			      }
		       }
			   //判断值仅包含字符
			   if(SubObj.inString){
			      if(!IsInString(SubObj.inString,Trim(SubObj.value))){
					 if(errMsg==''){
				        alert('The '+ Caption + ' can only be a string "'+SubObj.inString+'" the characters in any combination');
					 }
					 else{
						alert(errMsg); 
					 }
					 focusObj.focus();
					 return false;
				  }
			   }
			   //判断值不能包含字符
			   if(SubObj.exString){
				  flag=false
				  for(i=0;i<Trim(SubObj.value).length;i++){
					  if(SubObj.exString.indexOf(Trim(SubObj.value).substr(i,1))>=0){
					     flag=true;
					  }
				  }
			      if(flag){
					 if(errMsg==''){
				        alert('The '+Caption + 'should not include any character of "'+SubObj.exString+'"');
					 }
					 else{
					    alert(errMsg)
					 }
					 focusObj.focus();
					 return false;
				  }
			   }
			   //判断重复对象是否相等
			   if(SubObj.repeatObject){
				  repeatObj=eval(SubObj.repeatObject)
				  if(repeatObj){
			         if(SubObj.value!=repeatObj.value){
						if(repeatObj.Caption){
			               repeatCaption=repeatObj.Caption
			            }
			            else{
			               repeatCaption=repeatObj.name
			            }
				        alert(Caption+"与" + repeatCaption+"输入的值不相同");
					    focusObj.focus();
					    return false;
				     }
				  }
			   }
		  }
			   
			   //判断值的格式
			   if(SubObj.formatString){
			      if(Trim(SubObj.formatString)!=''){
				     P=SubObj.formatString.indexOf('_')
				     if(P<0){
					    alert(Caption+'formatString的属性书写不正确');
						focusObj.focus();
					    return false;
					 }
					 if(SubObj.formatString.substr(P+1,1)=="Y" && (Trim(SubObj.value)==''|| SubObj.value==null || SubObj.value.toUpperCase()=='NULL')){
						if(errMsg==''){
					      alert('The '+Caption + ' can not be free.')
						}
						else{
						  alert(errMsg)	
						}
						focusObj.focus();
					    return false;
					 }
					 switch(SubObj.formatString.substr(0,P)){
					    case 'NUM':
						     if(Trim(SubObj.value) != "" && SubObj.value!=null) {
		                          if (isNaN(SubObj.value)) {
									 if(errMsg==''){
			                            alert('The '+ Caption + ' can only be NO.');
									 }
									 else{
									    alert(errMsg);	 
									 }
									 focusObj.focus();
			                         return false;
		                          }
	                         }
						     break; 
						case 'EML':
						     if(Trim(SubObj.value) != "" && SubObj.value!=null) {
						           if (SubObj.value.charAt(0)=="." ||SubObj.value.charAt(0)=="@"||SubObj.value.indexOf('@', 0) == -1||SubObj.value.indexOf('.', 0) == -1||SubObj.value.lastIndexOf("@")==SubObj.value.length-1||SubObj.value.lastIndexOf(".")==SubObj.value.length-1) {
			                          if(errMsg==''){
			                             alert('The '+ Caption + ' is not valid E-mail address.');
									  }
									  else{
									     alert(errMsg);
									  }
									  focusObj.focus();
			                          return false;
								   }
							 }
						     break;  
						case 'DAT':
						     if(Trim(SubObj.value) != "" && SubObj.value!=null) {
							    if(SubObj.value.indexOf('-')>=0){
						           if(!isDate(SubObj.value,'-')){
									  if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD".');
									  }
									  else{
									     alert(errMsg);
									  }
									  focusObj.focus();
			                          return false;
								   }
								}
								else if(SubObj.value.indexOf('/')>=0){
								   if(!isDate(SubObj.value,'/')){
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY/MM/DD".');
									  }
									  else{
									     alert(errMsg);
									  }
									  focusObj.focus();
			                          return false;
								   }
								} 
								else if(SubObj.value.indexOf('.')>=0){
								   if(!isDate(SubObj.value,'.')){
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY.MM.DD".');
									  }
									  else{
									     alert(errMsg);
									  }
			                          return false;
								   }
								}
								else{
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD".');
									  }
									  else{
									     alert(errMsg);
									  }
			                       return false;
								}
                             }								
						     break;
						case 'TIM':
						     if(Trim(SubObj.value) != "" && SubObj.value!=null) {
							    if(SubObj.value.indexOf(':')>=0){
								   if(!isTime(SubObj.value)){
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "hh:mm:ss".');
									  }
									  else{
										 alert(errMsg); 
									  }
									  focusObj.focus();
			                          return false;
								   }
								}
								else{
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "hh:mm:ss".');
									  }
									  else{
										 alert(errMsg); 
									  }
			                       return false;
								}
							 }
							 break;
						case 'D T':
						     if(Trim(SubObj.value) != "" && SubObj.value!=null) {
								if(SubObj.value.indexOf(' ')>=0){
								   P=SubObj.value.indexOf(' ')
								   Dstr=SubObj.value.substr(0,P)
								   Tstr=SubObj.value.substr(P+1)
								}
								else{
								   alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD hh:mm:ss".');
								   focusObj.focus();
			                       return false;
								}
								//校验日期
							    if(Dstr.indexOf('-')>=0){
						           if(!isDate(Dstr,'-')){
									  if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD hh:mm:ss".');
									  }
									  else{
									     alert(errMsg);
									  }
									  focusObj.focus();
			                          return false;
								   }
								}
								else if(Dstr.indexOf('/')>=0){
								   if(!isDate(Dstr,'/')){
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD hh:mm:ss"');
									  }
									  else{
									     alert(errMsg);
									  }
									  focusObj.focus();
			                          return false;
								   }
								} 
								else if(Dstr.indexOf('.')>=0){
								   if(!isDate(Dstr,'.')){
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY.MM.DD hh:mm:ss".');
									  }
									  else{
									     alert(errMsg);
									  }
			                          return false;
								   }
								}
								else{
								      if(errMsg==''){
			                             alert('The ' + Caption + 'is not valid,Please specify in form of "YYYY-MM-DD hh:mm:ss".');
									  }
									  else{
									     alert(errMsg);
									  }
			                       return false;
								}
								//校验时间
								if(Tstr.indexOf(':')>=0){
								   if(!isTime(Tstr)){
								      if(errMsg==''){
			                             alert('The '+Caption + ' of time part is not valid,Please specify in form of "hh:mm:ss".');
									  }
									  else{
										 alert(errMsg); 
									  }
									  focusObj.focus();
			                          return false;
								   }
								}
								else{
								      if(errMsg==''){
			                             alert('The '+Caption + ' of time part is not valid,Please specify in form of "hh:mm:ss".');
									  }
									  else{
										 alert(errMsg); 
									  }
			                       return false;
								}
                             }	
							 break;
					 }
				  }
			   }
	        }
    }
    return true;
}
