function CheckJuminNumber(strJunminNumber1, strJunminNumber2) //주민등록번호 유효성검사함수
{
var sum;
sum = 0;
sum += strJunminNumber1.charAt(0)*2;
sum += strJunminNumber1.charAt(1)*3;
sum += strJunminNumber1.charAt(2)*4;
sum += strJunminNumber1.charAt(3)*5;
sum += strJunminNumber1.charAt(4)*6;
sum += strJunminNumber1.charAt(5)*7;
sum += strJunminNumber2.charAt(0)*8;
sum += strJunminNumber2.charAt(1)*9;
sum += strJunminNumber2.charAt(2)*2;
sum += strJunminNumber2.charAt(3)*3;
sum += strJunminNumber2.charAt(4)*4;
sum += strJunminNumber2.charAt(5)*5;
check = (11 - sum%11)%10;
if (strJunminNumber2.charAt(6) != check || (strJunminNumber1.length != 6 && strJunminNumber2.length != 7))
{
return ;
}
if(!(strJunminNumber2.charAt(0) == '1' || strJunminNumber2.charAt(0) == '2' || strJunminNumber2.charAt(0) == '3' || strJunminNumber2.charAt(0) == '4'))
{
return ;
}
return true;
}
'웹프로그래밍 > Javascript' 카테고리의 다른 글
[Jquery] 제이쿼리 셀렉터 (0) | 2012.05.04 |
---|---|
[Jquery] Jquery 에서의 AJAX 사용 (0) | 2012.05.04 |
[자바스크립트] Float 형 계산오류 수정 (0) | 2012.04.30 |
[JAVASCRIPT] 브라우저 크기(가로,세로) 구하기 (0) | 2012.04.11 |
[JAVASCRIPT] ie버전에 따른 윈도우 창닫기 (0) | 2011.05.12 |