fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <body> <p id="demo">Click the button to display the date after setting the date to be the last day of last month.</p> <button onclick="myFunction()">点我测试</button> <script> function myFunction() { var d = new Date(); d.setUTCMonth(d.getUTCMonth(),0); var x = document.getElementById("demo"); x.innerHTML=d; } </script> </body> </html>
运行结果