Here I go,
Take care that I can read javascriptJavaScript but itsit was a whole time ago that I effectifly writeeffectively wrote in that.
First :
- I see you've created your own
isNumericfunction.
I see yo create your own isNumeric function.
MaybeMaybe you can use the isNaN. Documentation over here.
Second :
You use twice this :
((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
You use this twice:
((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
If you use such a statement more thenthan once, you should consider refactorrefactoring to a method.
Third :
function onlyAlphabets(e, t) {
try {
if (window.event) {
var charCode = window.event.keyCode;
} else if (e) {
var charCode = e.which;
} else {
return true;
}
if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || (charCode === 8)) return true;
else return false;
} catch (err) {
alert(err.Description);
}
}
What is the meaning of t? (you don't use it)
Fourth :
function alpha(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
}
What is the meaning of
t? (you don't use it)function onlyAlphabets(e, t) { try { if (window.event) { var charCode = window.event.keyCode; } else if (e) { var charCode = e.which; } else { return true; } if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || (charCode === 8)) return true; else return false; } catch (err) { alert(err.Description); } }Very bad naming of method:
function alpha(e) { var k; document.all ? k = e.keyCode : k = e.which; return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8); }
Very bad naming of method first of all and don'tDon't you do it almost the same as the function mentioned in the third issue?