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 | <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title >Insert title here</ title > < link rel = "stylesheet" type = "text/css" /> </ head > < body > < h1 >JQuery 달력</ h1 > < h2 >date Picker</ h2 > < p > 선택일:< input type = "text" id = "date" > </ p > < p > text박스를 클릭하면, < strong >캘린더</ strong >가 표시됩니다 </ p > 년도: < p id = "year" ></ p > 월: < p id = "month" ></ p > 일: < p id = "day" ></ p > 요일: < p id = "mydate" ></ p > < script type = "text/javascript" > $(function() { $("#date").datepicker( { dateFormat : "yy/mm/dd", dayNamesMin : [ "일", "월", "화", "수", "목", "금", "토" ], monthNames : [ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" ], onSelect : function(day) { alert(day + " 선택되었습니다"); var arrDate = day.split("/"); var year = arrDate[0]; var month = arrDate[1]; var day = arrDate[2]; $("#year").text(year); $("#month").text(month); $("#day").text(day); var date = new Date($("#date").datepicker({ dateFormat : "yy/mm/dd" }).val()); alert("date: " + date.getDay()); // 요일 alert("date: " + date.getDate()); // 일자 var week = new Array("일", "월", "화", "수", "목", "금", "토"); $("#mydate").text(week[date.getDay()]); } }); }); </ script > </ body > </ html > |