function check()
{
var code = document.getElementById("aa").value;
if(code.length != 18){
alert("社会信用代码长度错误!")
return false;
}
var reg = /^([0-9ABCDEFGHJKLMNPQRTUWXY]{2})([0-9]{6})([0-9ABCDEFGHJKLMNPQRTUWXY]{9})([0-9Y])$/;
if(!reg.test(code)){
alert("社会信用代码校验错误!")
return false;
}
var str = '0123456789ABCDEFGHJKLMNPQRTUWXY';
var ws =[1,3,9,27,19,26,16,17,20,29,25,13,8,24,10,30,28];
var codes = new Array();
codes[0] = code.substr(0,code.length-1);
codes[1] = code.substr(code.length-1,code.length);
var sum = 0;
for(var i=0;i<17;i++){
sum += str.indexOf(codes[0].charAt(i)) * ws[i];
}
var c18 = 31 - (sum % 31);
if(c18 == 31){
c18 = 'Y';
}else if(c18 == 30){
c18 = '0';
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载