《网页设计与制作》作业题:使用javascript实现显示当前时间!在线等!
2个回答
展开全部
<script language="javascript">
<!--
function showweek(){
now = new Date();
if (now.getDay() == 0) return ("星期日");
if (now.getDay() == 1) return ("星期一");
if (now.getDay() == 2) return ("星期二");
if (now.getDay() == 3) return ("星期三");
if (now.getDay() == 4) return ("星期四");
if (now.getDay() == 5) return ("星期五");
if (now.getDay() == 6) return ("星期六");
}
function showdate(){
var now = new Date();
var year = now.getYear();
var month = now.getMonth()+1;
var day = now.getDate();
return year+"年"+month+"月"+day+"日";
}
document.write(showdate()+" "+showweek());
-->
</script>
<!--
function showweek(){
now = new Date();
if (now.getDay() == 0) return ("星期日");
if (now.getDay() == 1) return ("星期一");
if (now.getDay() == 2) return ("星期二");
if (now.getDay() == 3) return ("星期三");
if (now.getDay() == 4) return ("星期四");
if (now.getDay() == 5) return ("星期五");
if (now.getDay() == 6) return ("星期六");
}
function showdate(){
var now = new Date();
var year = now.getYear();
var month = now.getMonth()+1;
var day = now.getDate();
return year+"年"+month+"月"+day+"日";
}
document.write(showdate()+" "+showweek());
-->
</script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询