<input type= "text" name = "12" onchange= "validar(this)" />
function validar(obj) { if (obj.value == 'pepe') alert('Error') }