Lost here。以下在Chrome中的作品奇妙,但在IE和FireFox 「undefined undefined NaN Nan」被退回jquery date conversion chrome works but IE and firefox do not
我錯過了什麼?
var dateString = $(this).attr("ows_EventDate");
var current_date = new Date(dateString);
var month_names = [];
month_names[month_names.length] = "January";
month_names[month_names.length] = "February";
month_names[month_names.length] = "March";
month_names[month_names.length] = "April";
month_names[month_names.length] = "May";
month_names[month_names.length] = "June";
month_names[month_names.length] = "July";
month_names[month_names.length] = "August";
month_names[month_names.length] = "September";
month_names[month_names.length] = "October";
month_names[month_names.length] = "November";
month_names[month_names.length] = "December";
var day_names = [];
day_names[day_names.length] = "Sunday";
day_names[day_names.length] = "Monday";
day_names[day_names.length] = "Tuesday";
day_names[day_names.length] = "Wednesday";
day_names[day_names.length] = "Thursday";
day_names[day_names.length] = "Friday";
day_names[day_names.length] = "Saturday";
var startU = (day_names[current_date.getDay()]) + (", ")
+ (month_names[current_date.getMonth()]) + (" ") + current_date.getDate()
+ (" ") + (" ") + current_date.getFullYear();
鉻返回... 2012年2月23日星期四等,完美。
Nan不是數字。 – joshua 2012-03-07 04:37:46
從$(this).attr(「ows_EventDate」)''出來的值的值是多少? – 2012-03-07 04:43:44
這個jsFiddle http://jsfiddle.net/jfriend00/rgMmH/適用於Chrome,Firefox和IE9。既然你沒有包含'$(this).attr(「ows_EventDate」);'的值,我不得不繞過它。 – jfriend00 2012-03-07 04:47:30