南湖虫子论坛深切关注灾区 我们和灾区人民永远在一起!
发新话题
打印

[分享] JavaScript实例日期星期的显示

JavaScript实例日期星期的显示

JavaScript实例日期星期的显示
源代码如下:

<!--todayDate = new Date();

date = todayDate.getDate();
month= todayDate.getMonth() +1;
year= todayDate.getYear();
document.write("今天是")
document.write("<br>")
if(navigator.appName == "Netscape")
{


document.write(1900+year);



document.write("
");


document.write(month);



document.write("
");


document.write(date);



document.write("
");


document.write("<br>")

}
if(navigator.appVersion.indexOf("MSIE") != -1)
{
document.write(year);
document.write("");
document.write(month);
document.write("");
document.write(date);
document.write("");
document.write("<br>")
}
if (todayDate.getDay() == 5) document.write("星期五")
if (todayDate.getDay() == 6) document.write("星期六")
if (todayDate.getDay() == 0) document.write("星期日")
if (todayDate.getDay() == 1) document.write("星期一")
if (todayDate.getDay() == 2) document.write("星期二")
if (todayDate.getDay() == 3) document.write("星期三")
if (todayDate.getDay() == 4) document.write("星期四")

TOP

发新话题