jquery-ui/demos/functional/templates/ui.datepicker.sel.html

55 lines
2.7 KiB
HTML
Raw Normal View History

2008-09-20 17:42:04 +00:00
<select id="selectMonth"><option value="01">Jan</option><option value="02">Feb</option>
<option value="03">Mar</option><option value="04">Apr</option>
<option value="05">May</option><option value="06">Jun</option>
<option value="07">Jul</option><option value="08">Aug</option>
<option value="09">Sep</option><option value="10">Oct</option>
<option value="11">Nov</option><option value="12">Dec</option></select>
<select id="selectDay"><option value="01">1</option><option value="02">2</option>
<option value="03">3</option><option value="04">4</option>
<option value="05">5</option><option value="06">6</option>
<option value="07">7</option><option value="08">8</option>
<option value="09">9</option><option value="10">10</option>
<option value="11">11</option><option value="12">12</option>
<option value="13">13</option><option value="14">14</option>
<option value="15">15</option><option value="16">16</option>
<option value="17">17</option><option value="18">18</option>
<option value="19">19</option><option value="20">20</option>
<option value="21">21</option><option value="22">22</option>
<option value="23">23</option><option value="24">24</option>
<option value="25">25</option><option value="26">26</option>
<option value="27">27</option><option value="28">28</option>
<option value="29">29</option><option value="30">30</option>
<option value="31">31</option></select>
<select id="selectYear"><option value="2001">2001</option><option value="2002">2002</option>
<option value="2003">2003</option><option value="2004">2004</option>
<option value="2005">2005</option><option value="2006">2006</option>
<option value="2007">2007</option><option value="2008">2008</option>
<option value="2009">2009</option><option value="2010">2010</option></select>
<input type="hidden" size="10" id="linkedDates" disabled="disabled"/></p>
<script type="text/javascript">
// Prepare to show a date picker linked to three select controls
function readLinked() {
$("#linkedDates").val($("#selectMonth").val() + "/" +
$("#selectDay").val() + "/" + $("#selectYear").val());
return {};
}
// Update three select controls to match a date picker selection
function updateLinked(date) {
$("#selectMonth").val(date.substring(0, 2));
$("#selectDay").val(date.substring(3, 5));
$("#selectYear").val(date.substring(6, 10));
}
// Prevent selection of invalid dates through the select controls
function checkLinkedDays() {
var daysInMonth = 32 - new Date($("#selectYear").val(),
$("#selectMonth").val() - 1, 32).getDate();
$("#selectDay option").attr("disabled", "");
$("#selectDay option:gt(" + (daysInMonth - 1) +")").attr("disabled", "disabled");
if ($("#selectDay").val() > daysInMonth) {
$("#selectDay").val(daysInMonth);
}
}
</script>