Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: LastModified - Javascript version


Message #1 by "Eddie Robitaille" <eddie.robitaille@s...> on Tue, 4 Feb 2003 23:48:16
---------------------------
Eddie Robitaille Replies: 

Whoops No... Sorry.  I should have made that clear. 

It's not for the same page...

My intention is to display the last modified date next to a  link to the 
news file in question.  Say from a Homepage. 

Thusly:Link =    Http://www.MySite.com/MyPath/MyNewsFile.htm   
Last Modified:   05.02.2003

In fact... also note that this is on an Intranet. So we're dealing 
entirely with a single web server here. The path/file passed to the 
function would be relative to the page where the link and date appears. 

Any ideas? 
 
 
------------------------


 
> If you are referring to the current page, then you can use ;

document.lastModified

this works on the client side - see http://www.greggriffiths.org for a 
sample in the footer.

At 23:48 04/02/03 +0000, you wrote:
>Hi
>It seems such a simple thing but I can't seem to make it work.
>
>So I have to ask. Is it not possible to use Javascript to query and return
>a file last Modified date from a simple HTML page:
>Something like:
>
><script type="text/javascript">
>
>         function ShowLastUpdate(MyFile){
>         var d = new Date()
>         var FileDate = new Date(MyFile.lastModified)
>         document.write(d.getDate())
>         document.write(".")
>         document.write(d.getMonth() + 1)
>         document.write(".")
>         document.write(d.getYear())
>}
></script>
>
>And you've already answered the question with what appears to be a server
>side code. (URL = http://p2p.wrox.com/archive/javascript/2002-07/73.asp)
>
>//---------------------------
>objFSO = Server.CreateObject("Scripting.FileSystemObject");
>f1 = objFSO.GetFile("c:\\autoexec.bat");
>var aDate = new Date(f1.DateLastModified)
>
>//---------------------------
>
>What do you think?
>
>Eddie R
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or
>to unsubscribe send a blank email to 
>




  Return to Index