»
AnglaisFran�aisVietnamien

Imprimer - Remplacer les caractères script - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Remplacer les caractères script
URL: https://www.javascriptbank.com/replace-characters-script.html

Remplacer les caractères script © JavaScriptBank.comRemplace une caractère ou multiples caractères dans un textbox lorsque le visiteur va à l'autre champ (ou dans cet exemple, clique sur le bouton "soumettre").

Version compl�te: jsB@nk » Form » Remplacer les caractères script
URL: https://www.javascriptbank.com/replace-characters-script.html



JavaScript
<SCRIPT LANGUAGE="JavaScript"><!-- Beginfunction replaceChars(entry) {out = "a"; // replace thisadd = "z"; // with thistemp = "" + entry; // temporary holderwhile (temp.indexOf(out)>-1) {pos= temp.indexOf(out);temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));}document.subform.text.value = temp;}//  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="subform"><font face="arial, helvetica" size="-1">[ In this example, all &quot;a&quot; characters are changed to &quot;z&quot; ]</font><p><input type=text name=text size=40 value="abcdabcd"><br><input type=button name=action value="Done!" onClick="replaceChars(document.subform.text.value);"><!-- Or to make it change when the user clicks the next --><!-- field, use this instead of the previous two lines: --><!--  <input type=text name=text size=40 value="abcdabcd" onBlur="replaceChars(this.value);">  --></p></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->