»
AnglaisFran�aisVietnamien

Imprimer - Bloc-clés de presse - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Validation » Bloc-clés de presse
URL: https://www.javascriptbank.com/block-key-press.html

Bloc-clés de presse © JavaScriptBank.comVous en avez assez de clients à l'aide caractères qui pourrait éventuellement rendre vos formulaires inutiles? Cet JavaScript empêche un utilisateur d'entrer certaines caractères dans des forme domaines.

Version compl�te: jsB@nk » Form » Validation » Bloc-clés de presse
URL: https://www.javascriptbank.com/block-key-press.html



JavaScript
<script language="javascript">/*Corneliu Lucian 'Kor' Rusucorneliulucian[at]gmail[dot]com*/var r={  'special':/[\W]/g,  'quotes':/['\''&'\"']/g,  'notnumbers':/[^\d]/g}function valid(o,w){  o.value = o.value.replace(r[w],'');}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form id="myform" method="" onsubmit="return false;">  This field will not accept special characters: (like !@#$%* etc,) - but accepts underscore _  <br>  <input size="35" name="comments" onkeyup="valid(this,'special')" onblur="valid(this,'special')" type="text">  <br>  <br>  This field will not accept double or single quotes:  <br>  <input size="35" name="txtEmail" onkeyup="valid(this,'quotes')" onblur="valid(this,'quotes')" type="text">  <br>  <br>  This field will only accept integer numbers:  <br>  <input size="35" name="txtPostal" onkeyup="valid(this,'notnumbers')" onblur="valid(this,'notnumbers')" type="text"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->