<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
</head>
<body>
<p id="demo">单击按钮显示月份名称:</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var month=new Array();
month[0]="一月";
month[1]="二月";
month[2]="三月";
month[3]="四月";
month[4]="五月";
month[5]="六月";
month[6]="七月";
month[7]="八月";
month[8]="九月";
month[9]="十月";
month[10]="十一月";
month[11]="十二月";
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML=month[d.getMonth()];
}
</script>
</body>
</html>