Results 1 to 4 of 4

Thread: Putting Last Modified Date in footer with external js

  1. #1
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Putting Last Modified Date in footer with external js

    Hello,

    I am fairly new to Javascript - so HELP!!!.

    I have to make a template page with "Date Last Modified" on the bottom of the page and next to this date will be a name, copyright symbol and 2011.

    The Javascript code has to be put in an external file.This is the code for the date I need to use:

    This document was last modified on:
    <script type="text/javascript">
    document.write(document.lastModified);
    </script>
    (Then this?)Guys Name &nbsp&nbsp copyright symbol 2011

    I am not sure what goes where - the src"" reference of the external file goes in the top of the body, I think, then how do I get the footer to display at bottom of page and do I write in the guys name and copyright/year part after the closing </script> that will be included in the external file??

    The easier way for me would be better if there are various ways to do this. Any input would be greatly appreciated!

    Jim

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Put this and only this in the external script file:

    Code:
    document.write(document.lastModified);
    Save it as lastmod.js and put it in the same folder as the page.

    Change this:

    Code:
    <script type="text/javascript">
     document.write(document.lastModified);
     </script>
     (Then this?)Guys Name &nbsp&nbsp copyright symbol 2011
    to:

    Code:
    <script type="text/javascript" src="lastmod.js"></script>
     (Then this?)Guys Name &nbsp&nbsp copyright symbol 2011
    That's it. And other than changing the script, there's virtually no other way.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much for the help. I have it working however, how can I stick this content to bottom (or footer) of the page?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The same way you would anything else. It may be javascript, but it just outputs ordinary text.

    So, say your footer was:

    HTML Code:
    <div id="footer">
    Some stuff Here
    </div>
    Now it can be:

    HTML Code:
    <div id="footer">
    Some stuff Here
    <script type="text/javascript" src="lastmod.js"></script>
     (Then this?)Guys Name &nbsp&nbsp copyright symbol 2011
    </div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •