ddddddddddddddddd

var maxlength = felixdef.getAttribute('maxlength');
 if (maxlength != null && ! isNaN(maxlength)) {
  var length=0;
  for(var i=0;i<value.length;i++){
   if(value.charCodeAt(i)>128){
    length+=2;
   }else{
    length++;
   }
   if(length>maxlength){
    var param = new Array;
    param[0] = display;
    param[1] = maxlength;
    param[2] = maxlength/2;
    felixhint.innerHTML = errors.show('errors.maxlength', param);
   return false;
   }
  }
 }

 // only half-width characters check
 var halfwidth = felixdef.getAttribute('only.halfwidth');
 if (halfwidth != null && halfwidth.toUpperCase() == 'TRUE') {
  if (! onlyHalfWidth(value)) {
   felixhint.innerHTML = errors.show('errors.halfwidth', display);
   return false;
  }
 }

 // only digits check
 var digits = felixdef.getAttribute('only.digits');
 if (digits != null && digits.toUpperCase() == 'TRUE') {
  if (! onlyDigits(value)) {
   felixhint.innerHTML = errors.show('errors.digits', display);
   return false;
  }
 }

 // email format check
 var email = felixdef.getAttribute('email.format');
 if (email != null && email.toUpperCase() == 'TRUE') {
  if(value.length>100){
   var param = new Array;
   param[0] = display;
   param[1] = 100;
   felixhint.innerHTML = errors.show('errors.maxlength', param);
  }
  if (! emailFormat(value)) {
   felixhint.innerHTML = errors.show('errors.email', value);
   return false;
  }
 }
 
  // email size check
 var emailSize = felixdef.getAttribute('email.size');
 if (emailSize != null && ! isNaN(emailSize)) {
  var mesg=checkMailSize(value,emailSize,control);
   if(mesg=='1'){
    var param = new Array;
    param[0] = display;
    param[1] = checkMailSize;
    felixhint.innerHTML = errors.show('errors.emailsize', param);
    return false;
   }else if(mesg.length>0){
    felixhint.innerHTML = errors.show('errors.email', mesg);
    return false;    
   }
 }

你可能感兴趣的:(dd)