Javascript日期方程问题

时间:2015-11-03 22:16:52

标签: javascript date

我正在开设一个网页,它会显示今天的日期和啤酒风格以及月份的日期。但是,两者都没有出现,我不确定为什么。 Javascript似乎每次我尝试使用它时都会给我一些问题,我知道有人在这里可以帮助我。感谢。

HTML代码         

var style = new Array();
   style[1] = "Munich Helles";
   style[2] = "Robust Porter";
   style[3] = "American Wheat Beer";
   style[4] = "American Wild Ale";
   style[5] = "German Pilsner";
   style[7] = "Czech Pilsner";
   style[8] = "India Pale Ale";
   style[9] = "English Brown Porter";
   style[10] = "Kolsch";
   style[11] = "Altbier";
   style[12] = "Vienna Lager";
   style[13] = "Baltic Porter";
   style[14] = "Weissbier";
   style[15] = "Oatmeal Stout";
   style[16] = "Saison";
   style[17] = "Belgian Dark Strong Ale";
   style[18] = "California Common";
   style[19] = "Russian Imperial Stout";
   style[20] = "Belgian Dubbel";
   style[21] = "Cream Ale";
   style[22] = "English Brown Ale";
   style[23] = "Doppelbock";
   style[24] = "Rauchbier";
   style[25] = "Lambic";
   style[26] = "Gose";
   style[27] = "Gueze";
   style[28] = "Marzen";
   style[29] = "Scwarzbier";
   style[30] = "Pale Ale";
   style[31] = "Irish Stout";

function showDate() {
   thisDate = new Date();
   var thisWDay=thisDate.getDay();
   var thisDay=thisDate.getDate();
   var thisMonth=thisDate.getMonth();
   var thisYear=thisDate.getFullYear();
   var mName = new Array("January", "February", "March", "April", "May", 
   "June", "July", "August", "September", "October","November", "December");
   var wdName = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
   "Thursday", "Friday", "Saturday");
   return wdName[thisWDay]+", "+mName[thisMonth]+" "+thisDay+", "+thisYear;
}

function dayNumber() {
   thisDate = new Date();
   var leapYearDate = thisDate.setFullYear(2004);
   var baseDate = new Date("January 1, 2004");
   days = Math.floor((leapYearDate - baseDate)/(1000*60*60*24)+1);
   return days;
}

function showBeerStyle(day) {
   return style[day];
}

Javascript代码

{{1}}

0 个答案:

没有答案