간단한 날짜 자리수 체크 > JavaScript

본문 바로가기

사이트 내 전체검색

뒤로가기 JavaScript

간단한 날짜 자리수 체크

페이지 정보

작성자 최고관리자 작성일 21-02-10 17:27 조회 4,953 댓글 0

본문

<script language="JavaScript">
        function CheckDate(str,flag){ //날짜 자리수를 점검한다.
                  if(flag=='Y'){
                          if(str.value.length==2)        str.value="20"+str.value;       
                  }else{
                          if(str.value.length==1)        str.value="0"+str.value;
                  }               
        }

 </script>

 <input type=text name=yy1 value=2002 maxlength=4 size=4 onBlur="CheckDate(this,'Y')">-
<input type=text name=mm1 value=02 maxlength=2 size=2 onBlur="CheckDate(this,'M')">-
<input type=text name=dd1 value=21 maxlength=2 size=2 onBlur="CheckDate(this,'D')">

댓글목록 0

등록된 댓글이 없습니다.

Copyright © beautipia.co.kr. All rights reserved.

contact : webmaster@beautipia.co.kr

PC 버전으로 보기