サマリー:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>日歷</title> <style type="text/css"> div{width: 600px;height
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>日歷</title> <style type="text/css"> div{width: 600px;height: 100px;font-size: 20px;color:red;margin: 0 auto;margin-top: 300px;background: pink;line-height: 100px;text-align: center;} </style> </head> <body> <div>今天的日期是:<span id='pp'></span></div> <script type="text/javascript"> var mydate = new Date(); year = mydate.getFullYear(); var month = new Array(12); month[0] = '1月'; month[1] = '2月'; month[2] = '3月'; month[3] = '4月'; month[4] = '5月'; month[5] = '6月'; month[6] = '7月'; month[7] = '8月'; month[8] = '9月'; month[9] = '10月'; month[10] = '11月'; month[11] = '12月'; mon = month[mydate.getMonth()]; day = mydate.getDate(); hou = mydate.getHours(); min = mydate.getMinutes(); sec = mydate.getSeconds(); document.getElementById('pp').innerHTML=year+'年'+mon+day+'日'+hou+'時'+min+'分'+sec+'秒'; </script> </body> </html>
添削の先生:查無此人添削時間:2019-02-16 09:03:20
先生のまとめ:完成的不錯,日期時間函數(shù),多用在彈出時間選擇框。比如買機票,每天的價格不一樣。多練習(xí),繼續(xù)加油。