반응형
<html>
<head>
<title>주민등록번호를 입력하면 생년월일을 자동입력</title>
<head>
<script>
function checknum(num) {
var val="0123456789";
var string=num;
var len=string.length;
for(i=0;i<len;i++) {
if(val.indexOf(string.substring(i,i+1))<0) {
alert("숫자만 허용됩니다.");
return;
}
}
}
function check(){
var str = document.jumin.jumin_1.value.length;
if(str == 6)
document.jumin.jumin_2.focus();
}
function inputbirth() {
var temp1,temp2,temp3;
temp1=document.jumin.jumin_1.value.substring(0,2);
temp2=document.jumin.jumin_1.value.substring(2,4);
temp3=document.jumin.jumin_1.value.substring(4,6);
if( temp1 < 30 ){ document.jumin.birth_date1.value="20"+temp1; }
else { document.jumin.birth_date1.value="19"+temp1; }
document.jumin.birth_date2.value=temp2;
document.jumin.birth_date3.value=temp3;
}
</script>
</head>
<body>
<form name="jumin" action="#" method="POST">
주민등록번호
<input name="jumin_1" type="text" size="7" maxlength="6" OnKeyUp="check();" onChange="inputbirth()" onBlur="checknum(document.jumin.jumin_1.value)">
- <input name="jumin_2" type="text" size="7" maxlength="7" onBlur="checknum(document.jumin.jumin_2.value)"><BR>
생년월일
<input name="birth_date1" type="text" size="4" maxlength="4" onBlur="checknum(document.jumin.birth_date1.value)">년
<input name="birth_date2" type="text" size="2" maxlength="2" onBlur="checknum(document.jumin.birth_date2.value)">월
<input name="birth_date3" type="text" size="2" maxlength="2" onBlur="checknum(document.jumin.birth_date3.value)">일
<p>
<input type="submit" value="확인"><input type="reset" value="RESET">
</form>
</body>
</html>
<head>
<title>주민등록번호를 입력하면 생년월일을 자동입력</title>
<head>
<script>
function checknum(num) {
var val="0123456789";
var string=num;
var len=string.length;
for(i=0;i<len;i++) {
if(val.indexOf(string.substring(i,i+1))<0) {
alert("숫자만 허용됩니다.");
return;
}
}
}
function check(){
var str = document.jumin.jumin_1.value.length;
if(str == 6)
document.jumin.jumin_2.focus();
}
function inputbirth() {
var temp1,temp2,temp3;
temp1=document.jumin.jumin_1.value.substring(0,2);
temp2=document.jumin.jumin_1.value.substring(2,4);
temp3=document.jumin.jumin_1.value.substring(4,6);
if( temp1 < 30 ){ document.jumin.birth_date1.value="20"+temp1; }
else { document.jumin.birth_date1.value="19"+temp1; }
document.jumin.birth_date2.value=temp2;
document.jumin.birth_date3.value=temp3;
}
</script>
</head>
<body>
<form name="jumin" action="#" method="POST">
주민등록번호
<input name="jumin_1" type="text" size="7" maxlength="6" OnKeyUp="check();" onChange="inputbirth()" onBlur="checknum(document.jumin.jumin_1.value)">
- <input name="jumin_2" type="text" size="7" maxlength="7" onBlur="checknum(document.jumin.jumin_2.value)"><BR>
생년월일
<input name="birth_date1" type="text" size="4" maxlength="4" onBlur="checknum(document.jumin.birth_date1.value)">년
<input name="birth_date2" type="text" size="2" maxlength="2" onBlur="checknum(document.jumin.birth_date2.value)">월
<input name="birth_date3" type="text" size="2" maxlength="2" onBlur="checknum(document.jumin.birth_date3.value)">일
<p>
<input type="submit" value="확인"><input type="reset" value="RESET">
</form>
</body>
</html>
반응형
'9. 프로젝트 > └ 02. 홈페이지제작' 카테고리의 다른 글
엑셀->mysql (0) | 2008.05.26 |
---|---|
폼 추가/삭제 (0) | 2008.04.22 |
mysql 명령어 (0) | 2008.04.19 |
select 리스트 바로 리로드 하기! (0) | 2008.04.19 |
mysql 한글정렬 (0) | 2008.04.15 |