Google
 
Main Page
 The gatekeeper of reality is
 quantified imagination.

Stay notified when site changes by adding your email address:

Your Email:

Bookmark and Share
Coming Soon
Email Notification
jsCommon Validation [Go Back]
The following will return false until the duplicate 'a' character is removed:


The following will return false until a valid email address is entered:


The following will return false until a valid phone number is entered (() - + 0-9 allowed):


The following will return false until a valid zipcode is entered (- 0-9 allowed):


The following will return false until only alphabetic characters are present (a-z A-Z allowed):


The following will return false until only number characters are present (0-9 allowed):


The following will return the string with all leading whitespace removed:


The following will return the string with all trailing whitespace removed:


NOTE: You can download the script from the main javascript page.

Here's an extra function to try out. Ever had to deal with a copy-n-paste from a word document or PDF where quotes end up slanted and usually result in a strange a character in their place? The javascript below filters out slanted quotes into something standard.

function txtFilter_quotes(data) {
/* Slanted quotes can cause chaos. Compensate for it. */
var pamperTxt = "";
for (z = 0; z < data.length; z++) {
var holdme = data.charAt(z);
var holdmeCharCode = holdme.charCodeAt(0);
if (holdmeCharCode == 8216) { /* Slanted left single-quote */ pamperTxt = pamperTxt + "'"; }
else if (holdmeCharCode == 8217) { /* Slanted right single-quote */ pamperTxt = pamperTxt + "'"; }
else if (holdmeCharCode == 8218) { /* Slanted low single-quote */ pamperTxt = pamperTxt + "'"; }
else if (holdmeCharCode == 8220) { /* Slanted left double-quote */ pamperTxt = pamperTxt + "\""; }
else if (holdmeCharCode == 8221) { /* Slanted right double-quote */pamperTxt = pamperTxt + "\""; }
else if (holdmeCharCode == 8222) { /* Slanted low double-quote */ pamperTxt = pamperTxt + "\""; }
else { pamperTxt = pamperTxt + holdme; }
}
return (pamperTxt);
}
About Joe