strip characters




JavaScript Source Code 3000: Forms: Strip Characters








































Strip Characters







Strips 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!





This demo form will filter out all numeric values from the form below. Enter a combination of alpha and numeric characters and click "Submit" to view the results.











JavaScript Source Code 3000: Forms: Strip Characters
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!





    





<!-- TWO STEPS TO INSTALL STRIP CHARACTERS:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ryan A. Somma (ryan@waygate.com) -->
<!-- Web Site: http://www.waygate.com -->

<! >
<! >

<!-- Begin
function stringFilter (input) {
s = input.value;
filteredValues = "1234567890"; // Characters stripped out
var 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>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<font face=arial size=-2>
<p>This demo form will filter out all numeric values from the form below. Enter a combination of alpha and numeric characters and click "Submit" to view the results.
</font>
<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>



<!-- Script Size: 1.45 KB -->











Wyszukiwarka

Podobne podstrony:
AttributeSet CharacterAttribute
Metal Hollow Sphere Structures characteristics
2006 05?rtoon Creating Animated Characters with Blender
VtM Character Sheet Ravnos
replace characters
Tenchi Muyo Character Sheet
RealTime Character Sheet
TriStat dX Character Sheet
Character Subset
Lone Wolf Character Sheet Herbalish
Talislanta d20 Character Record Sheet

więcej podobnych podstron