»
EnglishFrenchVietnamese

Print - Strip Characters - JavaScriptBank.com

Full version: jsB@nk » Form » Strip Characters
URL: https://www.javascriptbank.com/strip-characters.html

Strip Characters © JavaScriptBank.comStrips the characters from an input string. You can change the characters you want removed from the string by changing one line of code. Very useful!

Full version: jsB@nk » Form » Strip Characters
URL: https://www.javascriptbank.com/strip-characters.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Ryan A. Somma ([email protected])<!-- Beginfunction stringFilter (input) {s = input.value;filteredValues = "1234567890";     // Characters stripped outvar i;var returnString = "";for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.var c = s.charAt(i);if (filteredValues.indexOf(c) == -1) returnString += c;}input.value = returnString;}//  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=thisform method=post action="" onSubmit=""><input type=text size=14 maxlength=14 name=inputField><br><input type=button value="Submit" onClick="stringFilter(inputField);"><input type=reset value="Reset"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->