各位大神帮忙看下,为什么加了条件判断之后就不打印了呢???

<html>

<head>

<script>

var date = new Date();

//年

var year = date.getFullYear();

//月

var month = date.getMonth()+1;

//日

var day = date.getDate();

//周

var week = date.getDay();

alert(week);


if(week==0){

str = "日";

}else if(week==1){

str = "一";

}else if(week==2){

str = "二";

}else if(week==3){

str = "三";

}else if(week==4){

str = "四";

}else if(week==5){

str = "五"

}else{

str = "六";

}

//时

var hours =date.getHours();

//分

var minutes = date.getMinutes();

//秒

var seconds = date.getSeconds();

var clock = "当前时间为:"+year+"年"+month+"月"+day+"日 周"+str+" "+hours+"时"+minutes+"分"+seconds+"秒";

document.write(clock);

</script>

</head>

<body>

</body>

</html>


ZA4
浏览 774回答 1
1回答

Caballarii

str = "四";后面的分号打成中文的了,"六"后面的也是
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript