-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.html
101 lines (89 loc) · 2.63 KB
/
table.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>다이어리</title>
<style>
td{
width: 80px;
height: 80px;
text-align: center;
font-size: 40px;
border:2px
border-radius: 8px;/*모서리 둥글게*/
}
#bt_enter{
height:40px;
width:90px;
}
</style>
<script type="text/javascript">
var reset=0;
var count=0;
var today = new Date();
function gotowrite(){
window.location ="https://zirafe.github.io/add_cal.html"
}
function prevcalendar(){
today = new Date(today.getFullYear(), today.getMonth()-1, today.getDate());
reset=1;
calendar();
}
function nextcalendar(){
today = new Date(today.getFullYear(), today.getMonth()+1, today.getDate());
reset=1;
calendar();
}
function calendar(){
var first_day = new Date(today.getFullYear(), today.getMonth(), 1);
var last_day = new Date(today.getFullYear(), today.getMonth()+1, 0);
var tbCalendarYM = document.getElementById("tbCalendarYM");
tbCalendarYM.innerHTML = today.getFullYear() + "년 " + (today.getMonth() + 1) + "월";
var tb = document.getElementById("calendar");
var row = tb.insertRow();
var cell = null;
if(reset==1){
for(i=0;i<count;i++){
tb.deleteRow(2);
}
}
for(i=0;i<first_day.getDay();i++){
cell = row.insertCell();
}
count = 1;
for(i=0;i<last_day.getDate();i++){
cell = row.insertCell();
if(row.cells.length==7){
row = tb.insertRow();
count+=1;
}
cell.innerHTML ="<input type='label' onclick='gotowrite()' value='" + (i+1) + "'>";
}
}
</script>
</head>
<body>
<h1 align="center">달력</h1>
<table id="calendar" border="3" align="center"
style="border-color:pink ">
<tr>
<td><label onclick="prevcalendar()"><</td>
<td align="center" id="tbCalendarYM" colspan="5">
a</td>
<td><label onclick="nextcalendar()">></td>
</tr>
<tr>
<td align="center"><font color ="red">일</td>
<td align="center">월</td>
<td align="center">화</td>
<td align="center">수</td>
<td align="center">목</td>
<td align="center">금</td>
<td align="center"><font color ="skyblue">토</td>
</tr>
</table>
<script language="javascript" type="text/javascript">
calendar();
</script>
</body>
</html>