This website is a great example of why the new ARC numbers will not have any difference to the inability for foreign residents to use websites. The underlying code checks the following:
-
ID number is 10 characters long
-
First digit is A-Z
-
second digit is 1 or 2
-
checksum is valid
//身分證驗證或統編 function ValidPid(sender, args) { var ChkID = $('#CPH_Content_txtPid').val().toUpperCase(); //alert(ChkID); if (ChkID.length == 8) { //alert('8'); if (ChkID.search(/^[0-9]{8}$/) == -1) { args.IsValid = false; } else { args.IsValid = true; } } else if (ChkID.length == 10) { //alert('10'); var city = new Array( 1, 10, 19, 28, 37, 46, 55, 64, 39, 73, 82, 2, 11, 20, 48, 29, 38, 47, 56, 65, 74, 83, 21, 3, 12, 30) if (ChkID.search(/^[A-Z](1|2)\d{8}$/i) == -1) { args.IsValid = false; } else { ChkID = ChkID.split('');//字串分割為陣列(for IE) var total = city[ChkID[0].charCodeAt(0) - 65]; for (var intT = 1; intT <= 8; intT++) { total += eval(ChkID[intT]) * (9 - intT); } total += eval(ChkID[9]); //最後一碼(檢查碼) args.IsValid = (total % 10 == 0); //檢查比對 } } else { args.IsValid = false; } }