Return to Snippet

Revision: 35611
at November 11, 2010 01:37 by elquemero


Initial Code
function validarn(e) { // 1
    tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
	 if (tecla==9) return true; // 3
	 if (tecla==11) return true; // 3
    patron = /[A-Za-zñÑ'áéíóúÁÉÍÓÚàèìòùÀÈÌÒÙâêîôûÂÊÎÔÛÑñäëïöüÄËÏÖÜ\s\t]/; // 4
	
    te = String.fromCharCode(tecla); // 5
    return patron.test(te); // 6
} 



<input type="text" class="inputText" name="nombre" onkeypress="return validarn(event)" />

Initial URL
http://www.telefonica.net/web2/blas-mar/validarformu.html

Initial Description

                                

Initial Title
No permitir ingresar ciertos caracteres en un input

Initial Tags
javascript, html, validation

Initial Language
JavaScript