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

본문 바로가기
사이트 내 전체검색

JavaScript

간단한 날짜 자리수 체크

페이지 정보

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

본문

<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')">

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

  • 게시물이 없습니다.

접속자집계

오늘
246
어제
4,449
최대
6,642
전체
881,808
contact : webmaster@beautipia.co.kr
Copyright © beautipia.co.kr. All rights reserved.