JS Display time JS display last modified time _javascript tips

Source: Internet
Author: User
This example implements the last modification time to display a Web page file. You first add a text box control to the page, and then use JavaScript to create a function that invokes the LastModified property of the Document object in the function, and then displays the last time the file was modified in the page's text box. This way you can view the update time for a Web page.
implementation Process
1. Write a custom function with the following code:
Copy Code code as follows:

<script language= "JavaScript" >
function Alterdate ()
Document.form1.textfield.value = document.lastmodified;

2. Add page HTML code, call the Alterdate () function in the body's onload event, the code is as follows:
Copy Code code as follows:

<body onload= "Alterdate" (), "background=" temp. JPG ">
<form name=" Form1 "method=" Post "action=" ">
<p><font color=" #FF00 Face= "Bold" size= "4" > last time to modify this file is:</font></p>
<input type= "text" name= TextField ">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.