Full version: jsB@nk » Calculation » ABA Routing Number Checksum
URL: https://www.javascriptbank.com/aba-routing-number-checksum.html
This JavaScript will validate an ABA routing number according to a given algorithm. (Although the number may be valid, it may not be actually assigned to a financial institution.)
Full version: jsB@nk » Calculation » ABA Routing Number Checksum
URL: https://www.javascriptbank.com/aba-routing-number-checksum.html
<script type="text/javascript">// Created by: David Leppek :: www.azcode.com/ABA<!--function ABAMod10(aba) { //v2.0 var valid = "0123456789"; var len = aba.length; var bNum = true; var iABA = parseInt(aba); var sABA = aba.toString(); var url = "abaDisplay2.asp?aba=" + sABA; var iTotal = 0; var bResult = false; var temp; //alert(aba); for (var j=0; j<len; j++) { temp = "" + document.abaForm.aba.value.substring(j, j+1); if (valid.indexOf(temp) == "-1") bNum = false; } if(!bNum){alert("Not a Number");} if(len !=0) { // incase they omit the number entirely. if(len != 9) { alert("This is not a proper ABA length"); } else { for (var i=0; i<len; i += 3) { iTotal += parseInt(sABA.charAt(i), 10) * 3 + parseInt(sABA.charAt(i + 1), 10) * 7 + parseInt(sABA.charAt(i + 2), 10); } if (iTotal != 0 && iTotal % 10 == 0){ bResult = true; // used for AJAX posting of data // get(this.parentNode); } else { alert("This is NOT a valid ABA Routing Number!"); bResult = false; } } } else { // zero length do nothing } // reset the frame detail. if (!bResult) { // used for AJAX posting of data //document.getElementById('myspan').innerHTML = ""; } else { alert("This COULD BE a valid ABA Routing Number!"); } // end of not shown in page version of code return bResult;}// --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="abaForm" onSubmit="javascript:return ABAMod10(document.abaForm.aba.value);"><table width="400" border="0" cellspacing="0" cellpadding="5" align="center" style="border: 1px solid black;"> <tr> <td width="150">ABA Routing Number: </td> <td width="150"><input name="aba" type="text" value="123123123" size="15" maxlength="9" id="aba"> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="Button" value="TEST ABA NUMBER" > </td> </tr></table></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->