function Check () {
var bankno = document.getElementById ("BankAccount"). Value;
alert (Bankno);
var lastnum = Bankno.substr (bankno.length-1, 1);//Remove the last one (compared to LUHM)
var first15num = bankno.substr (0, bankno.length-1);//First 15 or 18 bits
var newArr = new Array ();
for (var i = first15num.length-1 i > 1; i--) {//First 15 or 18-bit reverse deposit array
Newarr.push (First15num.substr (i, 1));
}
var Arrjishu = new Array (); The product <9 of odd-digit *2
var arrJiShu2 = new Array (); The product >9 of odd-digit *2
var Arroushu = new Array (); Array of even digits
for (var j = 0; J < Newarr.length; J + +) {
if ((j + 1)% 2 = 1) {//odd digits
if (parseint (Newarr[j]) * 2 < 9)
Arrjishu.push (parseint (Newarr[j]) * 2);
Else
Arrjishu2.push (parseint (Newarr[j]) * 2);
} else
Even digit
Arroushu.push (Newarr[j]);
}
var jishu_child1 = new Array ()//odd digit *2 >9 array single-digit digits after split
var jishu_child2 = new Array ();//10 digits after the partition of the odd-digit *2 >9
for (var h = 0; h < arrjishu2.length; h++) {
Jishu_child1.push (parseint (arrjishu2[h])% 10);
Jishu_child2.push (parseint (arrjishu2[h])/10);
}
var Sumjishu = 0; The sum of an array of odd-digit *2 < 9
var Sumoushu = 0; The sum of the array of even digits
var sumJiShuChild1 = 0; The sum of single digits of an array after the *2 >9 of odd digits
var sumJiShuChild2 = 0; The sum of 10 digits of an array after *2 >9 of odd digits
var sumtotal = 0;
for (var m = 0; m < arrjishu.length; m++) {
Sumjishu = Sumjishu + parseint (arrjishu[m));
}
for (var n = 0; n < arroushu.length; n++) {
Sumoushu = Sumoushu + parseint (arroushu[n));
}
for (var p = 0; p < jishu_child1.length; p++) {
SumJiShuChild1 = SumJiShuChild1 + parseint (jishu_child1[p));
SumJiShuChild2 = sumJiShuChild2 + parseint (jishu_child2[p));
}
Calculate sum
SumTotal = parseint (Sumjishu) + parseint (Sumoushu)
+ parseint (sumJiShuChild1) + parseint (sumJiShuChild2);
alert (sumtotal);
Calculate Luhm Value
var k = parseint (sumtotal)% 10 = 0? 10:parseint (sumtotal)% 10;
var luhm = 10-k;
if (Lastnum = = Luhm) {
Alert ("bank card number verification succeeded.") ");
return true;
} else {
Alert ("The bank card entered incorrectly, please check your real bank card number.") ");
document.getElementById ("Spreadnametip"). style.display= "None";
return false;
}
}
function Check (sId) {
var oimg = document.getelementsbytagname (' img ');
var radios = $ (' #frm Input[type=radio] ');
for (var i = 0; i < oimg.length; i++) {
if (oimg[i].id = = sId) {
Oimg[i].previoussibling.previoussibling.checked = true;
Oimg[i].style.border = ' 1px solid red ';
} else {
Oimg[i].style.border = ' 0px solid red ';
}
}
for (var i = 0; i < radios.length; i++) {
if (radios[i].id = = sId) {
Radios[i].nextsibling.nextsibling.style.border = ' 1px solid red ';
} else {
Radios[i].style.border = ' 0px solid red ';
}
}
}