jQuery 달력 컨트롤
페이지 정보
작성자 허니무스 댓글 0건 조회 1,279회 작성일 19-06-05 14:34본문
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script> $(function() { $( "#from" ).datepicker({ changeMonth: false, numberOfMonths: 2, defaultDate: +1, maxDate: "+2y", altField:"#from", altFormat:"yy-mm-dd", changeYear: true, monthNames: ['1','2','3','4','5','6','7','8','9','10','11','12'], onSelect: function( selectedDate ) { var nextday = new Date(selectedDate); nextday.setDate(nextday.getDate()); $( "#to" ).datepicker( "option", "minDate", nextday ); $( "#to" ).datepicker( "option", "defaultDate", 0); } }); $( "#to" ).datepicker({ changeMonth: false, numberOfMonths: 2, defaultDate: +2, altField:"#to", altFormat:"yy-mm-dd", monthNames: ['1','2','3','4','5','6','7','8','9','10','11','12'], changeYear: true, minDate:"+2d", maxDate: "+2y +1m", onSelect: function( selectedDate ) { } }); $( "#wr_8" ).datepicker({ numberOfMonths: 2, minDate:"-30d", maxDate: "+2y", altField:"#wr_8", altFormat:"yy-mm-dd", changeYear: true, monthNames: ['1','2','3','4','5','6','7','8','9','10','11','12'] }); }); // 날짜 차이 계산 함수 // date1 : 기준 날짜(YYYY-MM-DD), date2 : 대상 날짜(YYYY-MM-DD) function getDateDiff(date1,date2) { var arrDate1 = date1.split("-"); var getDate1 = new Date(parseInt(arrDate1[0]),arrDate1[1]-1,arrDate1[2]); var arrDate2 = date2.split("-"); var getDate2 = new Date(parseInt(arrDate2[0]),arrDate2[1]-1,arrDate2[2]); var getDiffTime = getDate1.getTime() - getDate2.getTime(); return Math.floor(getDiffTime / (1000 * 60 * 60 * 24)); } //alert(getDateDiff("2014-07-20","2014-07-8")); </script><tr> <th>기간</th> <td> <? $arr_wr_3 = explode("|^|", $write['wr_3']); ?> <input type="text" name="from" value="<?php echo $arr_wr_3[0] ?>" id="from" required class="frm_input required" size="30" maxlength="100"> <input type="text" name="to" value="<?php echo $arr_wr_3[1] ?>" id="to" required class="frm_input required" size="30" maxlength="100"> </td> </tr>
댓글목록
등록된 댓글이 없습니다.