English 中文(简体)
法定假日确认
原标题:javascript holiday validation

我想确认第一个领域,并显示其他内容。 检查日期和说明。

我的发言稿在工作,但我介绍var 日期除外。

$(document).ready(function () {
    $( #holidayDate ).datepicker();
    var availableTags = ["New years Day", "Martin Luther King Day", "Groundhog Day", "Valentine s Day", "Washington s Birthday",
        "Easter", "Earth Day", "National Arbor Day", "Mother s Day", "Memorial Day", "Flag Day", "Father s Day", "Independence Day",
        "Labor Day", "Columbus Day", "Halloween", "Veterans Day", "Thanksgiving Day", "Pearl Harbor Remembrance Day", "Christmas Day"
    ];
    $("#tags").autocomplete({
        source: availableTags
    });
    var Date = [Date().january().third().monday(), Date().february().third().monday()];
    $( #holidayDate ).change(function () {
        var dateString = $(this).val().substring(0, 5);
        switch (dateString) {
        case  01/01 :
            res = availableTags[0];
            break;
        case Date[0]:
            res = availableTags[1];
            break;
        case  02/02 :
            res = availableTags[2];
            break;
        case  02/14 :
            res = availableTags[3];
            break;
        case Date[1]:
            res = availableTags[4];
            break;
        case  04/22 :
            res = availableTags[6];
            break;
        case  06/14 :
            res = availableTags[10];
            break;
        case  07/04 :
            res = availableTags[12];
            break;
        case  10/31 :
            res = availableTags[15];
            break;
        case  11/11 :
            res = availableTags[16];
            break;
        case  12/07 :
            res = availableTags[18];
            break;
        case  12/25 :
            res = availableTags[19];
            break;
        }
        $( #tags ).val(res);
    });
});
最佳回答

你正在使用一个保留词(Date)。

把它归入类似的东西

var myDate = [Date().january().third().monday(),Date().february().third().monday()];
问题回答

当你宣布一个称为日期的变数时,你可以不使用所装日期标的。 将你们的变数改为别的东西。





相关问题
Mysql compaire two dates from datetime?

I was try to measure what is faster and what should be the best way to compare two dates, from datetime record in MySql db. There are several approaches how to grab a date from date time, but I was ...

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date ...

Convert date Python

I have MMDDYY dates, i.e. today is 111609 How do I convert this to 11/16/2009, in Python?

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

NSDateFormat, super simple! Where am I screwing up?

Ok, this is really simple, maybe I m a getting a bit burnt out, but seems like it should work, Query XML feed, put out date string, format, display in a cell. The issue is I m a getting a NULL ...

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export ...

热门标签