本文介绍了如何执行DatePicker。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 此示例中的datepicker不起作用。 错误代码: The datepicker is not working in this example. Error code:JavaScript runtime error: Object doesn't support property or method 'datepicker' 代码: Code:<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> /* create an array of days which need to be disabled */ var disabledDays = ["2-21-2010","2-24-2010","2-27-2010","2-28-2010","3-3-2010","3-17-2010","4-2-2010","4-3-2010","4-4-2010","4-5-2010"]; /* utility functions */ function nationalDays(date) { var m = date.getMonth(), d = date.getDate(), y = date.getFullYear(); //console.log('Checking (raw): ' + m + '-' + d + '-' + y); for (i = 0; i < disabledDays.length; i++) { if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1 || new Date() > date) { //console.log('bad: ' + (m+1) + '-' + d + '-' + y + ' / ' + disabledDays[i]); return [false]; } } //console.log('good: ' + (m+1) + '-' + d + '-' + y); return [true]; } function noWeekendsOrHolidays(date) { var noWeekend = jQuery.datepicker.noWeekends(date); return noWeekend[0] ? nationalDays(date) : noWeekend; } /* create datepicker */ jQuery(document).ready(function() { jQuery("#<%=TextBox1.ClientID%>").datepicker({ minDate: new Date(1900, 0, 1), maxDate: new Date(2100, 12, 31), dateFormat: 'DD, MM, d, yy', constrainInput: true, beforeShowDay: noWeekendsOrHolidays }); }); </script> 推荐答案 这篇关于如何执行DatePicker。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-29 18:55