制作熟悉并制作一个Date案例

Original 2019-04-04 17:55:30 273
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Date时间</title></head><body><script type="text/javascript">var mydate=

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Date时间</title>

</head>

<body>

<script type="text/javascript">

var mydate= new Date();

// document.write(date);

var year=document.write(mydate.getFullYear()+'年')

var month=document.write(mydate.getMonth()+'月'+'<br>')

var month=new Array(12)

month[0]="一月";

month[1]="二月";

month[2]="三月";

month[3]="四月";

month[4]="五月";

month[5]="六月";

month[6]="七月";

month[7]="八月";

month[8]="九月";

month[9]="十月";

month[10]="十一月";

month[11]="十二月";

    // document.write('这个月是'+ month[mydate.getMonth()]+'月')

document.write('这月是'+ mydate.getFullYear()+'年'+ month[mydate.getMonth()]+'星期'+ mydate.getDay()+'今天是这个月的第'+mydate.getDate()+'天'+mydate.getHours()+":"+mydate.getMinutes()+':'+mydate.getSeconds())



</script>

</body>

</html>


Correcting teacher:天蓬老师Correction time:2019-04-04 18:09:35
Teacher's summary:日期对象, 在js中是一个原生内置对象, 可以实现很多有趣的功能, 方法众多, 多多练习

Release Notes

Popular Entries