嗨,我的 datepicker 无法在 IE7 或 8 上运行时遇到问题,在 Chrome 和 Firefox 中运行良好,任何人都可以阐明问题可能是什么,我是一个相对新手,所以任何建议都会有所帮助。这是我的代码
<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>