푸른청년 푸르게 살고있나?  
home | 살아가기 | news | 세상보기 | tip&tech | 방명록 |  
   전체
   asp
   php
   jsp
   mssql
   mysql
   informix
   linux
   unix
   win2000
   javascript
   html
   oracle
   java
   etc
    
:: Tip&Tech > javascript
[자바스크립트] 주민번호 오류체크하기
다들  이미  쓰고  있겠지만.

<script language="JScript">
var errfound = false;
function Validate() {
if(!JuminCheck(document.regi.jumin1.value, document.regi.jumin2.value)){
document.regi.jumin1.focus();
alert("주민등록 번호가 틀렸습니다. 다시 써주세요!");
errfound=true;
}
else
window.alert("주민등록 번호가 맞았습니다. 다음 사이트로 이동합니다!");
return !errfound;
}

function JuminCheck(jumin1, jumin2){
check = false;
total = 0;
temp = new Array(13);

for(i=1; i<=6; i++)
temp[i] = jumin1.charAt(i-1);
for(i=7; i<=13; i++)
temp[i] = jumin2.charAt(i-7);

for(i=1; i<=12; i++){
k = i + 1;
if(k >= 10)
k = k % 10 + 2;
total = total + temp[i] * k;
}
mm = temp[3] + temp[4];
dd = temp[5] + temp[6];

totalmod = total % 11;
chd = 11 - totalmod;
if(chd == temp[13] && mm < 13 && dd < 32 && (temp[7]==1 || temp[7]==2))
check=true;
return check;
}
</script>

날짜: 2003-11-06 15:48:18, 조회수: 2207

다음글 [자바스크립트] 이메일 오류체크하기
이전글 [웹프로그램]첨부파일업로드시 파일사이즈 미리 알아내기

꼬리말
글쓴이 비밀번호 #스팸글방지(주인장 닉네임을 쓰시오)

  
since by 2003.03.23 / 3th 2005.07.26 / 4th 2009.04.22 made by bluesoul