下面的JS代碼輸出當前網頁最後修改時間,用到了document.lastModified屬性
1 2 3 4 5 6 7 8 9 <!DOCTYPE html> <html> <body> This document was last modified on: <script> document.write(document.lastModified); </script> </body> </html>運行效果如下:
1 This document was last modified on: 04/03/2015 02:42:22