var texto = document.getElementById("id_caja_texto").value; // o document.form.texto.value if(parseInt(texto) > 30) alert("Numero maximo 30");