0
力圖打造從用戶的Date對象輸入出生日期,然後getDay自今日起他們進入:創建從用戶輸入一個日期對象
MONTHS = 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; //months
var dateString = prompt('Enter your birth date in the form dd mmm yyyy','26 APR 1988'); //get users date of birth
var substrings = dateString.split(' ');
var day = substrings[0];
var month = substrings[1];
var year = substrings[2];
var pos = MONTHS.indexOf(MONTHS);
if (pos >= 0) {
}
alert(MONTHS.indexOf(month)/3);
var daysOfWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
var daysOfWeek = new Date('day','month','year');
document.writeln(daysOfWeek.getDay());{
我不知道要放什麼東西在新日期對象,我試了幾件事,我完全偏離軌道?
'{'這是一個錯字'document.writeln(daysOfWeek.getDay()); {' – Trialcoder 2014-12-07 11:32:46