<html> <head> <title>Calendar</title> <link rel="stylesheet" href="style.css" type="text/css"> <style type="text/css"> <!-- td { font-size:9pt; font-family:Verdana;} //--> </style> </head> <body style="margin:0px"> <!-- ÀÌÀü, ´ÙÀ½ ¹öÆ° ¹× ³â¿ù Ç¥½Ã --> <table width="245" cellspacing="0" cellpadding="0" align="center"> <tr> <td align="center" width="40" height="30"><input type="button" class="button" value="¢¸¢¸"
onclick="to_PreYear()"></td> <td align="center" width="30"><input type="button" class="button" value="¢·" onclick="to_PreMonth ()"></td> <td align="center" width="105"><div id="cal_title" style="color:#8FACCC"></div></td> <td align="center" width="30"><input type="button" class="button" value="¢¹" onclick="to_NextMonth ()"></td> <td align="center" width="40"><input type="button" class="button" value="¢º¢º" onclick="to_NextYear()"></td> </tr> </table> <!-- ´Þ·Â Ãâ·Â ºÎºÐ --> <table width="245" cellspacing="0" cellpadding="0" align="center" id="cal_Table"> <table> <!-- <table width="245" cellspacing="0" cellpadding="0" align="center"> <tr><td height="10" /></td> <tr> <td> </td> <td align="right" width="60"><input type="button" name='today' class="button" value="Today" style="font-family:verdana" onClick="writeValue()"></td> <td align="right" width="60"><input type="button" name='none' class="button" value="None" style="font-family:verdana" onClick="writeValue()"></td> <td width="5"> </td> </tr> </table> --> </BODY> </HTML> </html> <!------------------------------- script ½ÃÀÛ --------------------------------> <script language="javascript">
var date_Of_Month = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); // ÇØ´ç ´Þ¿¡ ´ëÇÑ ÀÏ ¼ö.. // var day_Of_Week = new Array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ); // ¿äÀÏÇ¥½Ã ¹®±¸ var day_Of_Week = new Array( "ìí", "êÅ", "ûý", "â©", "ÙÊ", "ÐÝ", "÷Ï" ); // ¿äÀÏÇ¥½Ã ¹®±¸ var date = new Date(); var currYear = date.getFullYear(); // ÇöÀç ³â var currMonth = date.getMonth()+1; // ÇöÀç ¿ù var currDate = date.getDate(); // ÇöÀç ÀÏ var currDay = date.getDay(); // ÇöÀç ¿äÀÏ var year = currYear; // Ãâ·ÂµÉ ³â var month = currMonth; // Ãâ·ÂµÈ ¿ù var dayOfWeekBgColor = '#D2DEEB'; // ¿äÀÏÇ¥½Ã ¹è°æ»ö var preDateColor = '#CECFCE'; // ÀÌÀü´Þ ³¯Â¥ »ö var nextDateColor = '#CECFCE'; // ´ÙÀ½´Þ ³¯Â¥ »ö var saturdayColor = 'blue'; // Åä¿äÀÏ Ç¥½Ã »ö var sundayColor = 'red'; // ÀÏ¿äÀÏ Ç¥½Ã »ö var mouseOverColor = '#FFFCC0'; // ¸¶¿ì½º ¿À¹ö½Ã »ö±ò var mouseOutColor = 'white'; // ¸¶¿ì½º ¾Æ¿ô½Ã »ö±ò printCal(); // À±³âÀ̸é true ¾Æ´Ï¸é false¸¦ return function leapYear(year) { if( year%4 ==0 && year%100 !=0 || year%400==0 ) { return true; } return false; } // ÇØ´ç ³â¿ù¿¡ ¸î ÀÏÀÌ ÀÖ´ÂÁö return function getDate(r_year, r_month) { if( r_month == 13 ) { r_month = 1; r_year++; } else if( r_month == 0 ) { r_month = 12; r_year--; } if( leapYear(r_year) ) { date_Of_Month[1] = 29; } else { date_Of_Month[1] = 28; } return date_Of_Month[r_month-1]; } // Ãâ·ÂÇÏ´Â ÇÔ¼ö --a function printCal() { var rowCnt = cal_Table.rows.length; // ÇöÀç Å×ÀÌºí¿¡ Ãâ·ÂµÇ¾î ÀÖ´Â Çà °¹¼ö for( var i=0; i<rowCnt ;i++ ) { // Ãâ·ÂµÇ¾î ÀÖ´Â Çàµé »èÁ¦ cal_Table.deleteRow(); } var currDateObj = new Date(year, month-1, 1); // Ãâ·ÂµÉ ´Þ date °´Ã¼ var currDayOfWeek = currDateObj.getDay(); // Ãâ·ÂµÉ ´Þ 1ÀÏ ¿äÀÏ var currLastDate = getDate(year, month); // Ãâ·ÂµÉ ´Þ ¸¶Áö¸· ÀÏ var printRowCnt = Math.ceil( ( currDayOfWeek + currLastDate ) / 7 ); // Ãâ·ÂµÉ ÇàÀÇ °¹¼ö var preLastDate = getDate(year, month-1); // ÀԷ¹ÞÀº ´Þ ÇÑ´ÞÀü date °´Ã¼ // Á¦¸ñ Ç¥½Ã cal_title.innerHTML = year + "Ò´ " + month + "êÅ"; // ¿äÀÏ Ãâ·Â var row2 = cal_Table.insertRow(); var w_td; for( var i=0; i<day_Of_Week.length ;i++ ) { w_td = row2.insertCell(); w_td.innerHTML = day_Of_Week[i]; w_td.style.textAlign = 'center'; w_td.style.backgroundColor = dayOfWeekBgColor; // w_td.style.borderWidth = '1px'; // <=-- BorderºÎºÐ ÁöÀúºÐÇØ º¸¿©¼ Áö¿üÀ½ // w_td.style.borderStyle = 'solid'; // w_td.style.borderColor = '#FFFFFF'; w_td.width = '35'; w_td.height = '25'; } // ³¯Â¥ Ãâ·Â var i_tr; // Temp tr Object var i_td; // Temp td Object var tempInt = 1; var tempInt2 = 1; for( var i=0; i<printRowCnt; i++ ) { i_tr = cal_Table.insertRow(); for( var j=0; j<7; j++ ) { // ù¹ø° ÇàÀ϶§ if( i == 0 && j < currDayOfWeek) { i_td = i_tr.insertCell(); i_td.innerHTML = preLastDate - currDayOfWeek + j + 1; i_td.style.color = preDateColor; i_td.id = year + '-' + (month-1) + '-' + (preLastDate - currDayOfWeek + j + 1); if( month - 1 == 0 ) { i_td.id = (year-1) + '-12-' + (preLastDate - currDayOfWeek + j + 1); } } // ¸¶Áö¸· ÇàÀ϶§ else if ( i == printRowCnt-1 && tempInt == currLastDate+1 ) { i_td = i_tr.insertCell(); i_td.innerHTML = tempInt2++; i_td.style.color = nextDateColor; i_td.id = year + '-' + (month+1) + '-' + (tempInt2-1); if( month + 1 == 13 ) { i_td.id = (year+1) + '-1-' + (tempInt2-1); } } // À̰͵µ Àú°Íµµ ¾Æ´Ò¶§.. else { i_td = i_tr.insertCell(); i_td.innerHTML = tempInt++; i_td.id = year + '-' + month + '-' + (tempInt-1); if( currYear == year && currMonth == month && tempInt-1 == currDate ) { i_td.style.backgroundColor = 'yellow'; i_td.style.fontWeight = 'bolder'; } if( j == 0 ) { i_td.style.color=sundayColor; } if( j == 6 ) { i_td.style.color=saturdayColor; } } i_td.attachEvent( 'onclick', writeValue ); i_td.attachEvent( 'onmouseover', changeBgColorOver ); i_td.attachEvent( 'onmouseout', changeBgColorOut ); i_td.style.cursor = 'hand'; i_td.style.paddingRight = '10px' i_td.style.textAlign = 'right'; i_td.width = '35'; i_td.height = '20'; } // for( var j=0; j<7; j++ ) } // for( var i=0; i<printRowCnt ;i++ ) // â Å©±â º¯È¯ window.resizeTo( 253, 123+eval(printRowCnt)*20 ); self.focus(); } // ÀÌÀü³â function to_PreYear() { year--; printCal(); } // ÀÌÀü´Þ function to_PreMonth() { month--; if( month == 0 ) { month = 12; year--; } printCal(); } // ´ÙÀ½³â function to_NextYear() { year++; printCal(); } // ´ÙÀ½´Þ function to_NextMonth() { month++; if( month == 13 ) { month = 1; year++; } printCal(); } // ¸¶¿ì½º ¿À¹ö½Ã ¹ÙÅÁ»ö º¯È¯ function changeBgColorOver() { var overObj = window.event.srcElement; if( overObj.id != (currYear + '-' + currMonth + '-' + currDate) ){ overObj.style.backgroundColor = mouseOverColor; } // overObj.style.textDecoration = 'underline'; // <=-- UnderLine~ } // ¸¶¿ì½º ¾Æ¿ô½Ã ¹ÙÅÁ»ö º¯È¯ function changeBgColorOut() { var outObj = window.event.srcElement; if( outObj.id != (currYear + '-' + currMonth + '-' + currDate) ){ outObj.style.backgroundColor = mouseOutColor; } // outObj.style.textDecoration = 'none'; // <=- UnderLine Ãë¼Ò~ } // ÀÔ·Â function writeValue() { var loc = document.location.href; loc = loc.substring(loc.indexOf("?")+1); var openerField = eval("opener." + loc); // var w_form = 'a'; // ÀԷµǾîÁú ºÎ¸ðâÀÇ FORM À̸§ // var w_input = 'i_a'; // ÀԷµǾîÁú ºÎ¸ðâÀÇ INPUT À̸§ // var f_input = 'f_a'; // ÀÔ·ÂµÈ ÈÄ FOCUS¸¦ °¡Áú ºÎ¸ðâÀÇ INPUT À̸§ var idValue = window.event.srcElement.id; if( window.event.srcElement.name == 'today' ) { idValue = currYear + '-' + currMonth + '-' + currDate; } if( window.event.srcElement.name == 'none' ) { idValue = ''; } openerField.value = idValue; // eval("opener."+w_form+"."+w_input).value = idValue; // eval("opener."+w_form+"."+f_input).focus(); self.close(); } </script> <!------------------------------- script ³¡ --------------------------------> <!------------------------------- calendar.html ³¡! --------------------------------------->
|