网页代码,显示年月日··帮忙看看哪里出错了!!

发布网友 发布时间:2024-10-24 04:27

我来回答

1个回答

热心网友 时间:1小时前

<script language="JavaScript">
var today = new Date(); //new Date大写
var day;
var date;
if(today.getDay()==0) day = "星期日" //注意getDay大写
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
date1 = "今天是"+ (today.getYear())+ "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日" ; //today.getDate()处你多了个(或者前面加(后面跟上)如:(today.getDate())及大小写
document.write(date1 +day);
</script>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com