简单教程
提交运行
代码编辑器:
<p id="demo">Click the button to display the date after changing the month.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var d = new Date(); d.setUTCMonth(4); var x = document.getElementById("demo"); x.innerHTML=d; } </script>
运行结果: