- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <p>点击按钮显示系统<b><em>时间</em></b></p>
-
- <button onclick="time()">时间</button>
-
- <script>
- function time(){
- document.getElementById("demo").innerHTML = Date();
- // document.write(Date())
- }
- </script>
-
- <p id="demo"></p>
- </body>
- </html>
鼠标点击按钮,输出系统时间