on
0928_Javascript : 내장객체 - Date
0928_Javascript : 내장객체 - Date
Insert title here * { margin: 0; padding: 0; box-sizing: border-box; } body { font-size: 14px; font-family: '맑은 고딕', 나눔고딕, 돋움, sans-serif; } #calendarLayout { width: 280px; margin: 30px auto; } #calendarLayout .subject { height: 37px; line-height: 37px; text-align: center; font-weight: 600; } #calendarLayout table { width: 100%; border-collapse: collapse; border-spacing: 0; } #calendarLayout table td { padding: 10px; text-align: center; border: 1px solid #ccc; } #calendarLayout table td:nth-child(7n+1) { color: red; } #calendarLayout table td:nth-child(7n) { color: blue; } #calendarLayout table td.gray { color: #ccc; } #calendarLayout table td.today { background: #e6ffff; } .subject>span, .footer>span { cursor: pointer; } .subject>span:hover, .footer>span:hover { color: tomato; } .footer { height: 25px; line-height: 25px; text-align: right; font-size: 12px; padding-right: 3px; } function calendar(y, m) { var date = new Date(y, m-1, 1); y = date.getFullYear(); m = date.getMonth()+1; var w = date.getDay(); // 요일:0~6 var week = ["일","월","화","수","목","금","토"]; // 배열 // 시스템 오늘 날짜 var now = new Date(); var ny = now.getFullYear(); var nm = now.getMonth()+1; var nd = now.getDate(); var out = "
| "+i+" | "; if(i != lastDay && ++w%7==0) { out+="
| "+ (++nextDay) +" | "; } out+="
from http://development-writing.tistory.com/303 by ccl(S) rewrite - 2021-09-29 07:02:21