jQuery Datepicker有多个选项

时间:2011-11-22 10:12:49

标签: javascript jquery datepicker

我想让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 %>
});

这是输出:

$(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']
        });
});

1 个答案:

答案 0 :(得分:5)

你可以试试吗:

$('#<%= 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

希望它会有所帮助