I have the next code:

```js
function valid_num(e){
    tecla = (document.all) ? e.keyCode : e.which;

    //Tecla de retroceso para borrar, siempre la permite
    if (tecla==8){
        return true;
    }

    //Allows only numbers
    patron =/[0-9]/;
    tecla_final = String.fromCharCode(tecla);
    return patron.test(tecla_final);
}
function valid_text(e){
    tecla = (document.all) ? e.keyCode : e.which;

    //Tecla de retroceso para borrar, siempre la permite
    if (tecla==8 || tecla == 32){
        return true;
    }

    // Allows only letters
    patron =/[a-z,A-Z,ñ,Ñ,á-ú,Á-Ú]/;
    tecla_final = String.fromCharCode(tecla);
    return patron.test(tecla_final);
}
function valid_numText(e){
    tecla = (document.all) ? e.keyCode : e.which;

    //Tecla de retroceso para borrar, siempre la permite
    if (tecla==8){
        return true;
    }

    // Allows numbers and letters
    patron =/[a-z,A-Z,0-9,ñ,Ñ]/;
    tecla_final = String.fromCharCode(tecla);
    return patron.test(tecla_final);
}
```

This is how I call the functions: 

```html
<input id="nombre" name="nombre" type="text" class="validate" onkeypress="return valid_text(event)" maxlength="20" value="<?=$nombre;?>">
```

Which works very well in Chrome but, when I open the same page in Firefox it doesn´t detect the tab key and the movement keys.
If someone can help me, I will be grateful.