Where The Streets Have No Name

회원인증시 쓸만한 팁 모음 본문

Developement/Web

회원인증시 쓸만한 팁 모음

highheat 2006. 4. 1. 02:28
<script>
<!--
//주민등록입력시 생년월일 자동입력
function inputbirth(str) {
 var temp1,temp2,temp3;
 temp1=document.form.ident.value.substring(0,2);
 temp2=document.form.ident.value.substring(2,4);
 temp3=document.form.ident.value.substring(4,6);
 document.form.byy.value=str+temp1;
 document.form.bmm.value=temp2;
 document.form.bdd.value=temp3;
}

//주민등록입력시 성별 자동입력
function inputgen() {
 var temp;
 temp1=document.form.ident1.value.substring(0,1);
 if (temp1 == "1" || temp1 == "3" ){
  document.form.gen[0].checked = true;
 }else{
  document.form.gen[1].checked = true;
 }
 if (temp1 == "1" || temp1 == "2" ){
  inputbirth("19");
 }else{
  inputbirth("20");
 }
 goJump('ident1', 7, 'byy')
}

function goJump(fname, len, goname)
{
 isNumber(fname);
 if (document.all[fname].value.length == len) document.all[goname].focus();
}

function isNumber( str ) {
 var temp = document.all[str].value;
 if( temp.length > 0 ){
  for(var i=0; i<temp.length; i++) {
   if(temp.charAt(i)<'0' || temp.charAt(i)>'9'){
    alert("숫자만 입력이 가능합니다.")
    document.all[str].value ="";
    document.all[str].focus();
    break;
   }
  }
 }
 return;
}
//-->
</script>

<form name="form" method="post">
<br>
주민등록번호 :
<input type="text" name="ident" class=box maxlength="6" size="6" onkeypress="goJump('ident', 6, 'ident1')">
-
<input type="text" name="ident1" class=box maxlength="7" size="7" onkeypress="inputgen()">

<br>
생년월일 :
<input type=text name="byy" class=box maxlength=4 size="4"> 년
<input type=text name="bmm" class=box maxlength=2 size="2"> 월
<input type=text name="bdd"  class=box maxlength=2 size="2"> 일생

<br>
성 별 :
<input type="radio" name="gen" value="0" checked  >남자
<input type="radio" name="gen" value="1"  >여자
</form>