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;
}
</script>
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=" ">
<center>
<p><font color=" #FF00 Face= "Bold" size= "4" > last time to modify this file is:</font></p>
<p>
<input type= "text" name= TextField ">
</p>
</center>
</form>
</body>