javascript 具有多个选项的 jQuery Datepicker
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8225111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery Datepicker with multiple options
提问by Ufuk Hac?o?ullar?
I am trying to get datepicker
to display the day names I am sending but it still uses default values. Is there something that should be turned off? Should I set values with single option statements? I don't get any errors in Firebug. Here's my code:
我试图datepicker
显示我发送的日期名称,但它仍然使用默认值。有什么应该关闭的吗?我应该使用单个选项语句设置值吗?我在 Firebug 中没有收到任何错误。这是我的代码:
$('#<%= txtDate.ClientID %>').datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: "-50:+10",
clickInput: true,
dayNames: <%= DayNames %> ,
dayNamesMin: <%= DayNamesMin %> ,
monthNames: <%= MonthNames %> ,
montNamesShort: <%=MonthNamesShort %>
});
Here's the output:
这是输出:
$(document).ready(function () {
$('#ctl00_ctl00_ctl00_body_body_CenterColumn_CvPersonalInfoControl_birthDate_txtDate').datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: "-50:+10",
clickInput: true,
dayNames: ['Pazartesi', 'Sal?', '?ar?amba', 'Per?embe', 'Cuma', 'Cumartesi', 'Pazar'] ,
dayNamesMin: ['Pzt', 'Sa', '?r?', 'Pr?', 'Cu', 'Cmt', 'Pzr'] ,
monthNames: ['Ocak', '?ubat', 'Mart', 'Nisan', 'May?s', 'Haziran', 'Temmuz', 'A?ustos', 'Eylül', 'Ekim', 'Kas?m', 'Aral?k'] ,
monthNamesShort: ['Ock', '?bt', 'Mrt', 'Nsn', 'Mys', 'Haz', 'Tem', 'A?u', 'Eyl', 'Ekm', 'Kas', 'Ara']
});
});
采纳答案by Sudhir Bastakoti
Can you try doing:
你可以尝试做:
$('#<%= txtDate.ClientID %>').datepicker({ dateFormat: 'DD/mm/yy', changeMonth: true, changeYear: true, yearRange: "-50:+10", clickInput: true, dayNames: <%= DayNames %> , monthNames: <%= MonthNames %> , monthNamesShort: <%=MonthNamesShort %> }); //the DD - day name long check the ref: http://docs.jquery.com/UI/Datepicker/formatDate
Hope it will be of some help
希望它会有所帮助