Funciones JS

function gKeyAceptaSoloTelefono(evt) {
    var key = ('charCode' in evt) ? evt.charCode : evt.keyCode;
    return (key <= 13 || (key >= 48 && key <= 57) || key == 45 || key == 35 || key == 42);
}
function soloLetras(e){
       key = e.keyCode || e.which;
       tecla = String.fromCharCode(key).toLowerCase();
       letras = " áéíóúabcdefghijklmnñopqrstuvwxyz";
       especiales = "8-37-39-46";

       tecla_especial = false
       for(var i in especiales){
            if(key == especiales[i]){
                tecla_especial = true;
                break;
            }
        }

        if(letras.indexOf(tecla)==-1 && !tecla_especial){
            return false;
        }
}
function NumDecimal(e, field) {
  key = e.keyCode ? e.keyCode : e.which
  // backspace
  if (key == 8) return true
  // 0-9
  if (key > 47 && key < 58) {
    if (field.value == "") return true
    regexp = /.[0-9]{4}$/
    return !(regexp.test(field.value))
  }
  // .
  if (key == 46) {
    if (field.value == "") return false
    regexp = /^[0-9]+$/
    return regexp.test(field.value)
  }
  // other key
  return false
 
}

function gKeyAceptaSoloEmail(evt) {

    var key = ('charCode' in evt) ? evt.charCode : evt.keyCode;

    return (key <= 13 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 45 || key == 64 || key == 95 || key == 46);
}

Como emplear funciones

<input type="text" class="form-control" onkeypress="return gKeyAceptaSoloTelefono(event);"/>

Validar email

function gValidarEmail(email) {
    /*if (gTrim(email)!=""){*/
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email)) {
        Swal.fire('La dirección de email es incorrecta.',
                '',
                'warning'
                );
        return false;
    }
    /*}*/
    return true;
}
<button type="submit" onclick="
var mai = getElemento(\'utxt_email\').value;
var n = mai.length; 
                                    
if(n > 0){
   if(!gValidarEmail(mai)){
       return;
   }
}">Boton</button>