0
您好我有一個與我的日期選擇器不工作與IE7或8,在Chrome和Firefox中工作正常的問題,任何人都可能會闡明什麼問題可能是什麼,我是一個相對的新手,所以任何建議將有所幫助。 這裏是我的代碼日期選擇器不工作在IE8
<script type="text/javascript" src="jquery/jquery.js"></script>
<link rel="stylesheet" href="jquery/themes/custom-theme/jquery.ui.all.css">
<script src="jquery/ui/jquery.ui.core.js"></script>
<script src="jquery/ui/jquery.ui.widget.js"></script>
<script src="jquery/ui/jquery.ui.datepicker.js"></script>
<script src="jquery/ui/jquery.ui.datepicker-de.js"></script>
<script>
// Please add here the days you want to avoid shipping cakes, like new year, etc.
natDays = [
[1, 2, 'new year'], [6, 7,], [8, 15,], [10, 26,], [11, 1,], [12, 8,],
// [1, 26, 'au'], [2, 6, 'nz'], [3, 17, 'ie'],
// [4, 27, 'za'], [5, 25, 'ar'], [6, 6, 'se'],
// [7, 4, 'us'], [8, 17, 'id'], [9, 7, 'br'],
//[10, 1, 'cn'], [11, 22, 'lb'], [12, 12, 'ke']
];
function nationalDays(date) {
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() == natDays[i][0] - 1
&& date.getDate() == natDays[i][1]) {
return [false, natDays[i][2] + '_day'];
}
}
return [true, ''];
}
function noWeekendsOrHolidays(date) {
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return nationalDays(date);
} else {
return noWeekend;
}
}
$(document).ready(function(){
$(function() {
$("#datepicker").datepicker({
showOn: "button",
buttonImage: "jquery/calendar.gif",
buttonImageOnly: true,
gotoCurrent: true,
minDate: +9,
beforeShowDay: noWeekendsOrHolidays,
regional: "DE"
});
//$("#datepicker").datepicker.regional['de'];
});
$("#shipping").change(function() {
if($('#shipping option:selected').text() == 'Deutschland'){
$("#datepicker").datepicker('option' , 'minDate' , '+9');
$("#datepicker").datepicker('setDate' , null);
}
else{
$("#datepicker").datepicker('option' , 'minDate' , '+4');
$("#datepicker").datepicker('setDate' , null);
}
});
// And now fire change event when the DOM is ready
// $('#shipping').trigger('change');
});
</script>
定義'不工作',你會嗎?你有任何特定的錯誤信息(在控制檯中)? – raina77ow
對不起,當我點擊Calender.gif時什麼都沒有出現 – user1630140
也許在[12,8]之後刪除最後的逗號,將有助於... 你現在沒有正確地結束該陣列 –