troubleshooting Question

Javascript not working?

Avatar of Richard Korts
Richard KortsFlag for United States of America asked on
JavaScript
24 Comments2 Solutions1113 ViewsLast Modified:
see this code:
	function isdigit(test) {
		if (test == "0" || test == "1" || test == "2" ||
	    	test == "3" || test == "4" || test == "5" ||
	    	test == "6" || test == "7" || test == "8" ||
	    	test == "9" || test == ".")
			return true;
		else {
			return false;
	     }
	}
// Function to determine if a field is numeric
	function isnumeric(field) {
		len = field.length;
		for (i = 0; i < len; i++)
			if (isdigit(field.charAt(i)) == false) {
				return false;
			}
		return true;
	}

and
pp6 = pp5.trim();
				alert("pp6 = " + pp6);
				pnl = pp6.length;
				alert("pnl = " + pnl);
				if (pnl > 11) {
					alert ("Invalid phone number.");
					return false;
				}
				if (! isnumeric(pp6)) {
					alert ("pp6 not numeric");
					alert ("Invalid phone number.");
					return false;
				}
In a specific case, pp5 is 6198559182

The alerts show pnl is 11 (impossible) and pp6 is NOT numeric (impossible).

What am I missing.

FYI, this was working a week or so ago; I am using Firefox, they just did a seemingly MAJOR update. I have not tried in Chrome. Could that be the problem? To my knowledge I have made no other changes (the date before I put in all the alerts was 11/21/17).
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 24 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 24 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros