PageSourceSearch

https://www.korea.kr/jsV5/calendar.js?time=202610021912

js korea.kr collected 2026-10-02 10:14:47 UTC 7,771 bytes, 245 lines download raw bytes

1var dateType = 1;	// 1: yyyymmdd, 2: ddmmyyyy
2
3function show_calendar(str_target, str_form, str_datetime) {
4	//document.getElementById("dim").style.display = "block";
5	
6	var arr_months = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
7	var week_days = ["일", "월", "화", "수", "목", "금", "토"];
8
9	var n_weekstart = 0; 
10	var dt_datetime = (str_datetime == null || str_datetime == "" || str_datetime.length != 10 ?  new Date() : str2dt(str_datetime));
11	var dt_prev_month = new Date(dt_datetime);
12	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
13	var dt_next_month = new Date(dt_datetime);
14	dt_next_month.setMonth(dt_datetime.getMonth()+1);
15
16	var dt_prev_year = new Date(dt_datetime);
17	dt_prev_year.setYear(dt_datetime.getFullYear()-1);
18
19
20	var dt_next_year = new Date(dt_datetime);
21	dt_next_year.setYear(dt_datetime.getFullYear()+1);
22
23	var dt_firstday = new Date(dt_datetime);
24	dt_firstday.setDate(1);
25	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
26	var dt_lastday = new Date(dt_next_month);
27	dt_lastday.setDate(0);
28	
29	var str_buffer = new String (
30		"<div id=\"calendar-title\" class=\"layer_claendar\">\n"+
31		"	<div class=\"toppart\">\n"+
32		"		<button id=\"prevYear\" title=\"이전 년도\" onclick=\"javascript:show_calendar('"+str_target+"', '"+str_form+"', '"+dt2dtstr(dt_prev_year)+"'); \">"+
33		"<i>이전 년도</i></button>\n" +
34		"		<button id=\"prevMonth\" title=\"이전 달\" onclick=\"javascript:show_calendar('"+str_target+"', '"+str_form+"', '"+ dt2dtstr(dt_prev_month)+"');\">"+
35		"<i>이전 달</i></button>	&nbsp;\n"+
36		"<b id=\"_calendarTableHeader\"><span class=\"year\">"+dt_datetime.getFullYear()+"년 </span> <span class=\"month\">"+arr_months[dt_datetime.getMonth()]+"월</span></b>&nbsp;   \n"+
37		"		<button id=\"nextMonth\" title=\"다음 달\" onclick=\"javascript:show_calendar('"+str_target+"', '"+str_form+"', '"+dt2dtstr(dt_next_month)+"');\">"+
38		"<i>다음 달</i></button>\n" +
39		"		<button id=\"nextYear\" title=\"다음 년도\" onclick=\"javascript:show_calendar('"+str_target+"', '"+str_form+"', '"+dt2dtstr(dt_next_year)+"');\">"+
40		"<i>다음 년도</i></button>\n" +
41		"	</div>"
42	);
43
44	str_buffer += "<table id=\"calendarTable\" class=\"calendarboard\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">  \n";
45	if(str_form.indexOf('from') > 0){
46		str_buffer += "	<caption>검색 시작일 선택</caption>\n";
47	}else{
48		str_buffer += "	<caption>검색 종료일 선택</caption>\n";
49	}
50		str_buffer += "	<colgroup>	<col width=\"14%\"><col width=\"14%\"><col width=\"14%\"><col width=\"14%\"><col width=\"14%\"><col width=\"14%\"><col width=\"14%\"></colgroup>  \n";
51	
52	var dt_current_day = new Date(dt_firstday);
53	
54	str_buffer += "		<thead><tr> \n";
55	for (var n=0; n < 7; n++){
56		str_buffer += "	<th scope=\"col\" >"+week_days[(n_weekstart+n)%7]+"</th>\n";
57	}
58	str_buffer += "		</tr></thead>\n";
59	iss = 0;
60	str_buffer += "		<tbody>\n";
61	while (dt_current_day.getMonth() == dt_datetime.getMonth() || dt_current_day.getMonth() == dt_firstday.getMonth()) {
62		str_buffer += "			<tr>\n";
63		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
64				if (dt_current_day.getDate() == dt_datetime.getDate() &&
65					dt_current_day.getMonth() == dt_datetime.getMonth()){
66					str_buffer += "				<td class=\"today\">";
67				}			
68				else if (dt_current_day.getDay() == 0){
69					str_buffer += "				<td class=\"sun\">";
70				}
71				else if (dt_current_day.getDay() == 6){
72					str_buffer += "				<td class=\"sat\">";
73				}
74				else{
75					str_buffer += "				<td>";
76				}
77
78				if (dt_current_day.getMonth() == dt_datetime.getMonth()){
79					str_buffer += "<a href=\"javascript:"+str_form+
80					".value='"+dt2dtstr(dt_current_day)+"';" + str_form + ".focus();hide_Calendar('"+str_target+"');\">"+dt_current_day.getDate()+"</a>";
81				}
82				else{ 
83					str_buffer += "&nbsp;";
84				}
85
86				str_buffer += "</td>\n";
87				dt_current_day.setDate(dt_current_day.getDate()+1);
88		}
89
90		str_buffer += "			</tr>\n";
91		iss++;
92	}
93	/*
94	if(iss == 5){
95		str_buffer += "<tr>\n";
96		for(q=0;q<7;q++){
97		str_buffer +="<td>&nbsp;</td>\n"
98		}
99		str_buffer +="</tr>\n";
100	}
101	*/
102	str_buffer +=
103		"</tbody>\n" +
104		"</table>\n" +
105		"<button class=\"cal_close\" onclick=\"hide_Calendar('"+str_target+"');\"><i>달력닫기</i></button>\n" +
106		"</div>";
107
108
109    document.getElementById(str_target).innerHTML = str_buffer;
110    document.getElementById(str_target).style.display = "block"
111	/*
112	var vWinCal = window.open("", "Calendar", "width=200,height=200,status=no,resizable=yes,top=200,left=2
11200");
113	vWinCal.opener = self;
114	var calc_doc = vWinCal.document;
115	calc_doc.write (str_buffer);
116	calc_doc.close();
117	*/
118}
119
120
121function str2dt (str_datetime) {
122	if (str_datetime.length != 10) {
123		return alert("Invalid Datetime format: "+ str_datetime);
124	}
125	
126	dts = new Date();    //today's date
127	ho = dts.getHours();
128	min = dts.getMinutes();
129	ss =  dts.getSeconds();
130
131	//alert(parseInt(str_datetime.substring(0,4)));
132	//alert(str_datetime.substring(4,6));
133	//alert(parseInt(str_datetime.substring(6,8)));
134
135//	return (new Date (2002, 8, 1,ho,min,ss));
136	
137
138	str_datetime = str_datetime.replace(/\-/g, '');
139	if(dateType == 1) {
140		return (new Date (parseInt(str_datetime.substring(0,4)), parseInt(toFomart2(str_datetime.substring(4,6)))-1, parseInt(str_datetime.substr(6,8)),ho,min,ss));
141	} else if(dateType == 2) {
142		return (new Date (parseInt(str_datetime.substring(4,8)), parseInt(toFomart2(str_datetime.substring(2,4)))-1, parseInt(str_datetime.substr(0,2)),ho,min,ss));
143	}
144}
145
146function dt2dtstr (dt_datetime) {
147
148	if(dateType == 1) {
149		return (new String (dt_datetime.getFullYear()+"-"+toFomart(dt_datetime.getMonth()+1)+"-"+toFomart(dt_datetime.getDate())+""));
150	} else if(dateType == 2) {
151		return (new String (toFomart(dt_datetime.getDate())+""+toFomart(dt_datetime.getMonth()+1)+""+dt_datetime.getFullYear()+""));
152	}
153}
154
155
156function dt2tmstr (dt_datetime) {
157	return (new String (
158			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
159}
160
161function toFomart( vals){
162 var  retval = "";
163  if(parseInt(vals) < 10 ){
164    retval = "0"+vals;
165  }else{
166    retval = vals;
167  }
168
169  return retval;
170}
171
172function toFomart2( vals){
173 var  retval = "";
174  if(parseInt(vals) < 10 ){
175    retval = vals.substring(1,2);
176  }else{
177    retval = vals;
178  }
179
180  return retval;
181}
182/*
183function openCalendar(strNodeNM, strValue) {
184	show_calendar(strNodeNM, strValue.replace(/\//g, ''));
185}
186*/
187
188function hide_Calendar(str_target){
189	//document.getElementById("dim").style.display = "none";
190	document.getElementById(str_target).style.display = "none";
191	
192}
193
194		function doDate(range){
195			var startDate = '';
196			var endDate = '';
197			if(range != 'direct') {
198				var currentDate = new Date();
199				endDate = dateFormat(currentDate,"-");
200
201				if (range == 'day') {
202					currentDate.setDate(currentDate.getDate()-1);
203				} else if (range == 'week') {
204					currentDate.setDate(currentDate.getDate()-7);
205				} else if (range == 'month') {
206					currentDate.setMonth(currentDate.getMonth()-1);
207				} else if (range == 'year') {
208					currentDate.setFullYear(currentDate.getFullYear()-1);
209				} else {
210					startDate = '1970-01-01';
211				}
212				
213				if (range == 'all') {
214					startDate = '1970-01-01';
215				}else{
216					startDate = dateFormat(currentDate,"-");	
217				}
218				
219			
220			
221			$("#srchStartDate").val(startDate);
222			$("#srchEndDate").val(endDate);
223			}else{
224			$("#srchStartDate").val('');
225			$("#srchEndDate").val('');
226			}
227		}
228		
229		
230		// 기간 설정
231		function dateFormat(date, separator) {
232			var year = date.getFullYear();
233			var month = date.getMonth() +1;
234			var day = date.getDate();
235			
236			if (month <10) {
237				month = "0" + month;
238			}
239
240			if (day <10) {
241				day = "0" + day;
242			}
243
244			return year + separator + month + separator + day;
245		}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.