早教吧 育儿知识 作业答案 考试题库 百科 知识分享

javascript显示当前日期和时间及星期几,格式如下“TodayisFriday,October23,2009.”

题目详情
javascript 显示当前日期和时间及星期几,格式如下“Today is Friday,October 23,2009.”
▼优质解答
答案和解析




无标题文档



var d=new Date();
function a(num){
switch(num){
case 0:return "January";break;
case 1:return "February";break;
case 2:return "March";break;
case 3:return "April";break;
case 4:return "May";break;
case 5:return "June";break;
case 6:return "July";break;
case 7:return "August";break;
case 8:return "September";break;
case 9:return "Octorber";break;
case 10:return "November";break;
case 11:return "December";break;
}
}
function b(num){
switch(num){
case 0:return "Sunday";break;
case 1:return "Monday";break;
case 2:return "Tuesday";break;
case 3:return "Wenseday";break;
case 4:return "Thursday";break;
case 5:return "Friday";break;
case 6:return "Saturday";break;
}
}
document.write("Today is "+b(d.getDay())+","+a(d.getMonth())+" "+d.getDate()+","+d.getFullYear());


看了 javascript显示当前...的网友还看了以下: