if(document.NOME_FORM.NOME_CAMPO.length > 4){
// è maggiore
}
else{
// è minore
}