function month(num) {
if (num == 1) {
return "January";
} else if (num == 2) {
return "Feburary";
} else if (num == 3) {
return "March";
} else if (num == 4) {
return "April";
} else if (num == 5) {
return "May";
} else if (num == 6) {
return "June";
} else if (num == 7) {
return "July";
} else if (num == 8) {
return "August";
} else if (num == 9) {
return "September";
} else if (num == 10) {
return "October";
} else if (num == 11) {
return "November";
} else if (num == 12) {
return "December";
} else {
return false;
}
}
jQuery/Javascript。有沒有更有效的方法來編寫這個功能?
順便說一句,你拼錯的「二月」! – david 2011-01-26 02:42:38
@david - 哈哈,我複製它。大聲笑。 – Reigel 2011-01-26 02:45:29
哈哈哈,謝謝。深夜錯誤。 – switz 2011-01-26 02:53:12