메뉴 건너뛰기

2015.02.03 20:06

달력

조회 수 6682 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<SCRIPT Language=" Javascript ">
<!-- 감춤
function calendar(){
  monthdays='312831303130313130313031'
  weekdays='일월화수목금토'
  now=new Date();    // 현재 일자, 시간
  day=now.getDate();   // 일자
  wkdy=now.getDay();   // 요일 (0=월요일, 1=화요일, ...)
  month=now.getMonth();   // 월   (0=1월, 2월=1, ....)
  year=now.getYear();   // 년
  startday=now;    // 현재 일자, 시간 복사
  startday.setDate(1);   // 복사된 일자, 시간에 일자를 1일로 설정
  wkdy1=startday.getDay();   // 1일의 요일은 얻음
  monthEnd=monthdays.substring((month*2),(month*2+2)) // 두자리씩 끊어 월 길이로
  if ((month==1)&&                         // 월이 2월(1)이며,
    (((year %4==0)&&(year %100 !=0))      // (4와 100으로 나눠 나머지가 없거나
    || (year % 400 ==0 ))) monthEnd=29;   // 400으로 나눠 나머지가 없으면) 29
  document .write ('<TR align=center><TD colspan=7 class=week>');
  document .write ('<FONT size=4 color=880000><B>');
  document .write (year+' 년 '+(month+1)+' 월</B>');  // 월은 month+1
  document .write ('</FONT></TD></TR><TR>')
  for (i=0;i<=6;i++){                    // 각 요일의 칸을 만듬
    document .write ('<TD class=week>'+
      ((i==0)?'<FONT color=red>':'')+   // 첫칸(0)이면 폰트색 red 아니면 null('')
      weekdays.substring(i,i+1)+'</TD>');  // weekdays에서 1자씩 끊어 요일 표시
  }
  document .write ('</TR><TR align=center>');  // 요일 컬럼 닫고 일자 컬럼 열기
  column=0;                          // 컬럼을 첫째칸으로 설정
  for (i=0;wkdy1>i;i++){             // 일자를 월초(1일) 요일 전까지 반복
    document .write ('<TD> </TD>');    // 빈칸 만들기
    column++;                        // 컬럼 1 증가
  }
  for ( i=1; i<=monthEnd; i++){      // 일자 칸 1 부터 월 길이까지 반복
    document .write (
      '<TD class='+                  // 칸 시작
      ((i==day) ? 'today' :          // 일자가 오늘과 같으면 class=today
        ((column==0) ? 'sun' :       // 아니고 (0번 컬럼이면 class=sun
          ((column==6) ? 'sat' :     // 아니고 (6번 컬럼이면 class=sat
          'normal')))+                //         아니면       class=normal)
      '>'+i+'</TD>');                // 일자 넣고 칸마감
    column++;                        // 컬럼 1 증가
    if(column==7){                   // 컬럼이 7이면 그 줄 끝내고 새줄 열기
      document .write ('</TR><TR>');
      column=0;                      // 컬럼을 첫째칸으로 설정
    }
  }                                  // for loop 종료
  for (i=column;i<=6;i++){           // 종료된 컬럼에서 마지막 컬럼까지 빈칸 넣기
    document .write ('<TD> </TD>');
  }
  document .write ('</TR></TABLE>');          // 줄 마감
  document .write ('<TABLE align=center><TR><TD class=bottom>'+
    '<FONT size=2><B>'+year+'</B> 년 <B>'+(month+1)+'</B> 월<B>'+day+'</B> 일 <B>'+
    ((wkdy==0) ? '즐거운 <FONT color=red>' : '')+weekdays.substring(wkdy,wkdy+1)+'</B>요일</FONT></TD></TR>');
}
// 감춤 끝  -->
</SCRIPT>
<STYLE type="text/css">
td.today { color:red; font-weight:bold; background-color:fe8; border:solid thin 1pt; border-color:#fff #f00 #f00 #fff;}
td.normal{ color:#088; font-weight:bold; background-color:eeddff; border:solid thin 1pt; border-color:#eef #88c #88c #eef;}
td.sun{ color:#880000; font-weight:bold; background-color:ffeedd; border:solid thin 1pt; border-color:#fee #c88 #c88 #fee;}
td.sat{ color:#088; font-weight:bold; background-color:f8d8ee; border:solid thin 1pt; border-color:#fee #c88 #c88 #fee;}
td.week{ color:#008; font-weight:bold; background-color:eee; border:solid thin 1pt; border-color:#fff #ccc #ccc #fff;}
td.bottom{ color:#066; background-color:eeeeee; border:solid thin 1pt; border-color:#fff #ccc #ccc #fff;}
.code {font-size:10pt;color:026;font-family:굴림;background:#dff;border:solid 1 #aea}
</STYLE>
</HEAD>

<BODY>
<TABLE align=center border=1 bgcolor=ddeeff class=calendar style="border:solid thin 2pt; border-color:#eff #88f #88f #eef;">
<SCRIPT>calendar();</SCRIPT>
</TABLE>
</BODY>
</HTML>


List of Articles
번호 제목 날짜 조회 수
147 자바스크립트로 네트워크 연결 확인하기 (Navigator onLine Property) file 2015.06.19 6197
146 정규식을 이용한 실시간 콤마(comma) 넣기 2015.06.19 7876
145 정규식을 이용한 콤마(comma) 제거하기 2015.06.19 6804
144 텍스트박스(input type = "text") 숫자 증가, 감소 시키기 - 쇼핑몰 주문 수량 file 2015.06.19 12281
143 Checkbox : 체크박스 체크여부 확인 file 2015.06.19 19010
142 마우스 드래그, 오른쪽 팝업메뉴, 선택 막기 (IE11, 파이어폭스, 크롬 확인) 2015.06.19 8577
141 예제 - 자바스크립트로 현재 달의 달력 만들기 (calendar) 2015.06.19 10061
140 핸드폰 번호 일부 마스킹크 작업 (정규식 이용) 2015.06.19 10741
139 창에 대한 정보얻기 (창 크기, 창 위치) file 2015.06.19 7297
138 Location 객체 - URL 파싱 - URL에서 전달인자 추출하기 함수 작성 file 2015.06.19 8523
137 예제 - 이미지를 원본 크기로 볼 수 있도록 새창으로 열기 확장 (리사이징 및 이미지 드래그) file 2015.06.19 6796
136 창 크기 최대화 시키기 file 2015.06.19 12217
135 JSON API - JSON.parse(), JSON.stringify() ( json 형태의 문자열을 JSON객체로 , JSON객체를 문자열로 ) file 2015.06.19 6289
134 자바스크립트 API 문서 2015.06.19 9086
133 공백 검사 함수 2015.06.19 14576
132 자바스크립트 아이디 기억하기 기능 구현 (쿠키저장) file 2015.06.19 10923
131 [라디오버튼 오류 체크] 간단한 문제 예제 file 2015.06.19 7712
130 iframe사용시 높이 자동 조절 2015.06.19 6958
129 이벤트 - 페이지 로드 후 이벤트 처리하기 ( window.onload ) file 2015.06.19 10871
128 jquery offset()을 이용한 부드러운 스크롤 이동 2016.09.01 7277
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved