»
AnglaisFran�aisVietnamien

Imprimer - Validation (Caractère) - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Validation » Validation (Caractère)
URL: https://www.javascriptbank.com/validation-character.html

Validation (Caractère) © JavaScriptBank.comSupprime automatiquement spécifié caractères de la zone de saisie. Bon pour les champs qui n'ont besoin que de texte/nombre intrants. Facilement modifiés pour accepter que le texte ou seulement des chiffres.

Version compl�te: jsB@nk » Form » Validation » Validation (Caractère)
URL: https://www.javascriptbank.com/validation-character.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Mikhail Esteves ([email protected])<!-- Beginvar mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;function dodacheck(val) {var strPass = val.value;var strLength = strPass.length;var lchar = val.value.charAt((strLength) - 1);if(lchar.search(mikExp) != -1) {var tst = val.value.substring(0, (strLength) - 1);val.value = tst;   }}function doanothercheck(form) {if(form.value.length < 1) {alert("Please enter something.");return false;}if(form.value.search(mikExp) == -1) {alert("Correct Input");return false;}else {alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");form.select();form.focus();return false;}alert("Correct Input");return false;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name=xyz onSubmit="return doanothercheck(this.txtTerm);"><input type="text" name="txtTerm" size="35" maxlength="50" value="" onKeyUp="javascript:dodacheck(xyz.txtTerm);"><br><input type=submit value=Check></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->