Click to See Complete Forum and Search --> : Need help last date modified script
Macman
08-31-2003, 01:40 AM
I have a last date modified script but don't know how to use it. I have two places on my idex page that would need to show the update and my other web pages just have an update in the company logo at the very bottom of the page. How do I insert this script and where so it will show the date the page was changed? See attached:confused:
Charles
08-31-2003, 06:10 AM
You don't need a "script" really, just one line of code. Put the following in your document where you want the date to appeaar:
<script type="text/javascript">
<!--
document.write('<p>Last modified:', new Date(document.lastModified).toDateString(), '</p>')
// -->
</script>
Note however that this will fail for the 13% of users who do not use JavaScript. If this date is at all important, or if you are trying to get the modification date of some other file, then you will have to use a server side method. Also note that because this will fail so often you will need to include in the write method anything associated with the date that you wouldn't want to appear if the date wasn't there.
Macman
08-31-2003, 11:34 AM
Thanks for the responce. I will give your suggestion a try and see how it works out.:)