다들 이미 쓰고 있겠지만.
<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,
조회수: 2404 |