document.lastModified

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • *.*

    document.lastModified

    Hey-

    I seem to be having a problem with the document.lastMo dified property.
    The way it is suppose to work is that it returns the date and time at
    which the document was last modified. IN my case it is returning the
    current date and time. It only does this when it is on the webserver.
    the code is:

    <script type="text/javascript"><!--
    function footer(){

    document.write( "Author: Me, ");

    document.write( "Created on 4/5/2004"+", ");

    document.write( "Last Modified:" +document.lastM odified+ ", ");

    document.write( "Best viewed in a Mozilla based web browser at
    1024x768");}

    //-->

    </script>

    in the body i have a call to the function footer:
    <div class="footer">

    <script type="text/javascript"><!--

    footer();

    //--></script>

    </div>

    any ideas on how to fic the problem. Basically what i am looking for
    is a javascript that dynamically shows the last modified.

    thanks
  • Snowpurr

    #2
    Re: document.lastMo dified

    Hi there.

    I looked at this text, stuck it in my editing program, and moved your {}
    brackets some in the function and it worked. Try to put {} on their own
    line, maybe it'll work better.

    ==============s tart=========== ==
    <head>
    <title>Docume nt Title</title>
    <script type="text/javascript">
    <!--
    function footer()
    {
    document.write( "Author: Me, ");
    document.write( "Created on 4/5/2004"+", ");
    document.write( "Last Modified:" +document.lastM odified+ ", ");
    document.write( "Best viewed in a Mozilla based web browser at
    1024x768");
    }
    //-->

    </script>
    </head>

    <body>
    <div class="footer">
    <script type="text/javascript">
    <!--
    footer();
    //-->
    </script>
    </div>
    </body>

    ====end=====


    "*.*" <debian@interne tfan.com> wrote in message
    news:aebc663a.0 404301701.3a32c 393@posting.goo gle.com...[color=blue]
    > Hey-
    >
    > I seem to be having a problem with the document.lastMo dified property.
    > The way it is suppose to work is that it returns the date and time at
    > which the document was last modified. IN my case it is returning the
    > current date and time. It only does this when it is on the webserver.
    > the code is:
    >
    > <script type="text/javascript"><!--
    > function footer(){
    >
    > document.write( "Author: Me, ");
    >
    > document.write( "Created on 4/5/2004"+", ");
    >
    > document.write( "Last Modified:" +document.lastM odified+ ", ");
    >
    > document.write( "Best viewed in a Mozilla based web browser at
    > 1024x768");}
    >
    > //-->
    >
    > </script>
    >
    > in the body i have a call to the function footer:
    > <div class="footer">
    >
    > <script type="text/javascript"><!--
    >
    > footer();
    >
    > //--></script>
    >
    > </div>
    >
    > any ideas on how to fic the problem. Basically what i am looking for
    > is a javascript that dynamically shows the last modified.
    >
    > thanks[/color]


    Comment

    • Dr John Stockton

      #3
      Re: document.lastMo dified

      JRS: In article <aebc663a.04043 01701.3a32c393@ posting.google. com>, seen
      in news:comp.lang. javascript, *.* <debian@interne tfan.com> posted at
      Fri, 30 Apr 2004 18:01:25 :[color=blue]
      >Hey-[/color]

      Hardly a polite beginning.
      [color=blue]
      >I seem to be having a problem with the document.lastMo dified property.[/color]

      In what way have you failed to benefit from looking this up in the
      regularly-posted newsgroup FAQ? The advice that it provides can be
      modified, in case of reasonable need.

      [color=blue]
      > The way it is suppose to work is that it returns the date and time at
      >which the document was last modified.[/color]

      "supposed". Well, maybe; but you cannot in general expect anything
      better than when it was last uploaded to the server.

      [color=blue]
      > IN my case it is returning the
      >current date and time. It only does this when it is on the webserver.
      > the code is:
      >
      ><script type="text/javascript"><!--
      > function footer(){
      >
      > document.write( "Author: Me, ");
      >
      > document.write( "Created on 4/5/2004"+", ");[/color]

      And how is one supposed to tell whether that means 4th May or April 5th,
      at least after next Monday? Probably you mean 2004-04-05, which
      everyone can understand.

      [color=blue]
      > document.write( "Last Modified:" +document.lastM odified+
      >", ");[/color]

      Apart from the question of whether the lastModified string is in a
      format acceptable to the reader, you also need to give the reader the
      time zone of the date/time.

      You have not told us what software you are testing this with.

      [color=blue]
      > document.write( "Best viewed in a Mozilla based web
      >browser at
      >1024x768");}[/color]

      Evidently you have much else still to learn. A web page should be
      designed to work with all browsers and window sizes - and do not assume
      full-screen viewing, either.

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

      Comment

      • *.*

        #4
        Re: document.lastMo dified

        Dr. Stockton,

        Thank you for tearing to shreds a newbie. With people like you out
        there, you wonder why people think computer people are arrogant
        people.

        Please do not fret Doctor. I will no longer bother the likes of such
        smart people like you. IM DONE WITH GOOGLE GROUPS!

        By the way thanks for answering my question. Your insight was so
        helpful that you solved my problem ten times over.

        Find someone your own size to pick on and PISS OFF.

        Comment

        • *.*

          #5
          Re: document.lastMo dified

          by the way.... be original. see the way it was meant to.
          WWW:"Best viewed in a Mozilla based web browser at 1024x768"

          Mozilla’s family of products are all designed to keep you safer and smarter online


          think for yourself.

          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: document.lastMo dified

            debian@internet fan.com (*.*) writes:
            [color=blue]
            > Thank you for tearing to shreds a newbie. With people like you out
            > there, you wonder why people think computer people are arrogant
            > people.[/color]
            [color=blue]
            > Please do not fret Doctor. I will no longer bother the likes of such
            > smart people like you. IM DONE WITH GOOGLE GROUPS![/color]

            Well, got a rough start, but make no mistake, every hint he gave you
            was something you would benefit from listening to (except perhaps the
            comment on the "Hey", which I can't see any problem with as a non
            native English speaker ... must be something local - indeed that was
            the only comment I would find unreasonable).

            And for the record, you are participating in a Usenet newsgroup.
            While Google has an interface to the newsgroups, they are not related
            to Google in any way (and indeed Google is not the best way to
            access news groups - a dedicated news reader is preferable).
            [color=blue]
            > By the way thanks for answering my question. Your insight was so
            > helpful that you solved my problem ten times over.[/color]

            It should, the answer was there - in particular the link to this
            group's FAQ which answers your question).
            [color=blue]
            > Find someone your own size to pick on and PISS OFF.[/color]

            And that too, was uncalled for, and not something that will make
            people take you seriously in a public forum.

            /L
            --
            Lasse Reichstein Nielsen - lrn@hotpop.com
            DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
            'Faith without judgement merely degrades the spirit divine.'

            Comment

            • Matt Kruse

              #7
              Re: document.lastMo dified

              "*.*" <debian@interne tfan.com> wrote:[color=blue]
              > Dr. Stockton,
              > Thank you for tearing to shreds a newbie. With people like you out
              > there, you wonder why people think computer people are arrogant
              > people.
              > Please do not fret Doctor. I will no longer bother the likes of such
              > smart people like you. IM DONE WITH GOOGLE GROUPS!
              > By the way thanks for answering my question. Your insight was so
              > helpful that you solved my problem ten times over.
              > Find someone your own size to pick on and PISS OFF.[/color]

              heh, welcome to c.l.j., a helpful newsgroup with a lot of good information,
              but home of several "elitist" people with attitudes. Don't worry, it happens
              with a lot of technical newsgroups. It's not unique to javascript. And not
              everyone here will attack you in the way that some here do.

              It seems like a quarter of the bandwidth of this group is used for
              "correcting " people and "teaching" them how they _should_ be doing things.
              I've seen lengthy, detailed responses to a question pointing out everything
              that the original poster should be doing differently in order to be
              perfectly standards-compliant, backwards-compatible, user-friendly, and
              international, yet never actually answering the question. Intelligent,
              logical people can sometimes be so focused on technical issues and
              correctness that they forget about being considerate and helpful. Sarcastic,
              demeaning replies to simple honest questions become the norm for some
              people. Its a shame.

              It was Doctor Stockton himself who recently pondered why newsgroup usage is
              declining, and I pointed out that part of it is people like him lurking in
              newsgroups like this, waiting to attack anyone who doesn't display the same
              proficiency in the language that he has, or dares to ask a question which is
              answered somewhere on the web or in some faq. It's this level of "elitism"
              that discourages new users from asking for help when they really need it,
              and makes them feel like the real knowledgeable people were never in the
              same position they were. Apparently, they were BORN with all the knowledge
              and experience they have.

              In general, this is a very helpful group. A lot of great answers are
              provided here.

              But there does need to be a certain level of politeness applied to some of
              the replies here from some newsgroup regulars. It would help to promote a
              more helpful forum, spread more information to those who need it in a way
              that they find helpful, and overall improve the quality of this newsgroup.

              IMO.

              --
              Matt Kruse
              Javascript Toolbox: http://www.mattkruse.com/javascript/



              Comment

              • *.*

                #8
                Re: document.lastMo dified

                Maybe a slight overreaction... but let me make it obvious what i
                thought was out of line.



                [color=blue]
                >Hey-[/color]

                Hardly a polite beginning.-> That was out of line
                [color=blue]
                >I seem to be having a problem with the document.lastMo dified[/color]
                property.

                In what way have you failed to benefit from looking this up in the
                regularly-posted newsgroup FAQ? The advice that it provides can be
                modified, in case of reasonable need.->I have looked at many different
                resources to find an answer. this was not the first and after reading
                his response it wont be the last.

                [color=blue]
                > The way it is suppose to work is that it returns the date and time at
                >which the document was last modified.[/color]

                "supposed". Well, maybe; but you cannot in general expect anything
                better than when it was last uploaded to the server.-> Keep your
                comments to yourself. If was working remotely like it was suppose to
                either the actual last modified date & time or January 1970

                [color=blue]
                > IN my case it is returning the
                >current date and time. It only does this when it is on the[/color]
                webserver.[color=blue]
                > the code is:
                >
                ><script type="text/javascript"><!--
                > function footer(){
                >
                > document.write( "Author: Me, ");
                >
                > document.write( "Created on 4/5/2004"+", ");[/color]

                And how is one supposed to tell whether that means 4th May or April
                5th,
                at least after next Monday? Probably you mean 2004-04-05, which
                everyone can understand.-> Yes and then all the americans (which is
                who the audience happens to be) would be confused. If the target
                market was more than a project for an obscure class then maybe i would
                have made it to european standards. I didnt ask for you to rate the
                content.

                [color=blue]
                > document.write( "Last Modified:" +document.lastM odified+
                >", ");[/color]

                Apart from the question of whether the lastModified string is in a
                format acceptable to the reader, you also need to give the reader the
                time zone of the date/time. -> In what difference would that make.
                The information that this is being used for is not time / day
                sensitive. the target audience does not care.

                You have not told us what software you are testing this with.-> Name
                it. Ive tested it on windows in all browsers (netscape 4.79, netscape
                6, netscape 7, mozilla 1.3, mozilla 1.6, firefox .8, firebird .7,
                firebird .6, msie 6) if i owned a mac or linux machine it would have
                been tested as throughly in them

                [color=blue]
                > document.write( "Best viewed in a Mozilla based web
                >browser at
                >1024x768");}[/color]

                Evidently you have much else still to learn. A web page should be
                designed to work with all browsers and window sizes - and do not
                assume
                full-screen viewing, either.->thanks for the heads up. it does. but
                it looks "best in". not to mention the web is better views in mozilla
                or any standards compliant browser.



                I came looking for tips on a problem i have been looking into for the
                past couple of days. i stumped professors and tutors.


                if anyone has had similar problems with the document.lastMo dified,
                please let me know.




                Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<smeillor. fsf@hotpop.com> ...[color=blue]
                > debian@internet fan.com (*.*) writes:
                >[color=green]
                > > Thank you for tearing to shreds a newbie. With people like you out
                > > there, you wonder why people think computer people are arrogant
                > > people.[/color]
                >[color=green]
                > > Please do not fret Doctor. I will no longer bother the likes of such
                > > smart people like you. IM DONE WITH GOOGLE GROUPS![/color]
                >
                > Well, got a rough start, but make no mistake, every hint he gave you
                > was something you would benefit from listening to (except perhaps the
                > comment on the "Hey", which I can't see any problem with as a non
                > native English speaker ... must be something local - indeed that was
                > the only comment I would find unreasonable).
                >
                > And for the record, you are participating in a Usenet newsgroup.
                > While Google has an interface to the newsgroups, they are not related
                > to Google in any way (and indeed Google is not the best way to
                > access news groups - a dedicated news reader is preferable).
                >[color=green]
                > > By the way thanks for answering my question. Your insight was so
                > > helpful that you solved my problem ten times over.[/color]
                >
                > It should, the answer was there - in particular the link to this
                > group's FAQ which answers your question).
                >[color=green]
                > > Find someone your own size to pick on and PISS OFF.[/color]
                >
                > And that too, was uncalled for, and not something that will make
                > people take you seriously in a public forum.
                >
                > /L[/color]

                Comment

                • *.*

                  #9
                  Re: document.lastMo dified

                  Matt-

                  i couldnt have said it better. while to be 100% web design correct i
                  should take the DR's advice. But there are some cases where you can
                  be not correct and still serve the purpose of the website.

                  thanks matt for your support!! if i every post a real question here
                  again i hope only people like you answer it.



                  "Matt Kruse" <newsgroups@mat tkruse.com> wrote in message news:<c73gjh029 t@news4.newsguy .com>...[color=blue]
                  > "*.*" <debian@interne tfan.com> wrote:[color=green]
                  > > Dr. Stockton,
                  > > Thank you for tearing to shreds a newbie. With people like you out
                  > > there, you wonder why people think computer people are arrogant
                  > > people.
                  > > Please do not fret Doctor. I will no longer bother the likes of such
                  > > smart people like you. IM DONE WITH GOOGLE GROUPS!
                  > > By the way thanks for answering my question. Your insight was so
                  > > helpful that you solved my problem ten times over.
                  > > Find someone your own size to pick on and PISS OFF.[/color]
                  >
                  > heh, welcome to c.l.j., a helpful newsgroup with a lot of good information,
                  > but home of several "elitist" people with attitudes. Don't worry, it happens
                  > with a lot of technical newsgroups. It's not unique to javascript. And not
                  > everyone here will attack you in the way that some here do.
                  >
                  > It seems like a quarter of the bandwidth of this group is used for
                  > "correcting " people and "teaching" them how they _should_ be doing things.
                  > I've seen lengthy, detailed responses to a question pointing out everything
                  > that the original poster should be doing differently in order to be
                  > perfectly standards-compliant, backwards-compatible, user-friendly, and
                  > international, yet never actually answering the question. Intelligent,
                  > logical people can sometimes be so focused on technical issues and
                  > correctness that they forget about being considerate and helpful. Sarcastic,
                  > demeaning replies to simple honest questions become the norm for some
                  > people. Its a shame.
                  >
                  > It was Doctor Stockton himself who recently pondered why newsgroup usage is
                  > declining, and I pointed out that part of it is people like him lurking in
                  > newsgroups like this, waiting to attack anyone who doesn't display the same
                  > proficiency in the language that he has, or dares to ask a question which is
                  > answered somewhere on the web or in some faq. It's this level of "elitism"
                  > that discourages new users from asking for help when they really need it,
                  > and makes them feel like the real knowledgeable people were never in the
                  > same position they were. Apparently, they were BORN with all the knowledge
                  > and experience they have.
                  >
                  > In general, this is a very helpful group. A lot of great answers are
                  > provided here.
                  >
                  > But there does need to be a certain level of politeness applied to some of
                  > the replies here from some newsgroup regulars. It would help to promote a
                  > more helpful forum, spread more information to those who need it in a way
                  > that they find helpful, and overall improve the quality of this newsgroup.
                  >
                  > IMO.[/color]

                  Comment

                  • *.*

                    #10
                    Re: document.lastMo dified

                    Matt-

                    i couldnt have said it better. while to be 100% web design correct i
                    should take the DR's advice. But there are some cases where you can
                    be not correct and still serve the purpose of the website.

                    thanks matt for your support!! if i every post a real question here
                    again i hope only people like you answer it.



                    "Matt Kruse" <newsgroups@mat tkruse.com> wrote in message news:<c73gjh029 t@news4.newsguy .com>...[color=blue]
                    > "*.*" <debian@interne tfan.com> wrote:[color=green]
                    > > Dr. Stockton,
                    > > Thank you for tearing to shreds a newbie. With people like you out
                    > > there, you wonder why people think computer people are arrogant
                    > > people.
                    > > Please do not fret Doctor. I will no longer bother the likes of such
                    > > smart people like you. IM DONE WITH GOOGLE GROUPS!
                    > > By the way thanks for answering my question. Your insight was so
                    > > helpful that you solved my problem ten times over.
                    > > Find someone your own size to pick on and PISS OFF.[/color]
                    >
                    > heh, welcome to c.l.j., a helpful newsgroup with a lot of good information,
                    > but home of several "elitist" people with attitudes. Don't worry, it happens
                    > with a lot of technical newsgroups. It's not unique to javascript. And not
                    > everyone here will attack you in the way that some here do.
                    >
                    > It seems like a quarter of the bandwidth of this group is used for
                    > "correcting " people and "teaching" them how they _should_ be doing things.
                    > I've seen lengthy, detailed responses to a question pointing out everything
                    > that the original poster should be doing differently in order to be
                    > perfectly standards-compliant, backwards-compatible, user-friendly, and
                    > international, yet never actually answering the question. Intelligent,
                    > logical people can sometimes be so focused on technical issues and
                    > correctness that they forget about being considerate and helpful. Sarcastic,
                    > demeaning replies to simple honest questions become the norm for some
                    > people. Its a shame.
                    >
                    > It was Doctor Stockton himself who recently pondered why newsgroup usage is
                    > declining, and I pointed out that part of it is people like him lurking in
                    > newsgroups like this, waiting to attack anyone who doesn't display the same
                    > proficiency in the language that he has, or dares to ask a question which is
                    > answered somewhere on the web or in some faq. It's this level of "elitism"
                    > that discourages new users from asking for help when they really need it,
                    > and makes them feel like the real knowledgeable people were never in the
                    > same position they were. Apparently, they were BORN with all the knowledge
                    > and experience they have.
                    >
                    > In general, this is a very helpful group. A lot of great answers are
                    > provided here.
                    >
                    > But there does need to be a certain level of politeness applied to some of
                    > the replies here from some newsgroup regulars. It would help to promote a
                    > more helpful forum, spread more information to those who need it in a way
                    > that they find helpful, and overall improve the quality of this newsgroup.
                    >
                    > IMO.[/color]

                    Comment

                    • John G Harris

                      #11
                      Re: document.lastMo dified

                      In article <smeillor.fsf@h otpop.com>, Lasse Reichstein Nielsen
                      <lrn@hotpop.com > writes

                      <snip>[color=blue]
                      >(except perhaps the
                      >comment on the "Hey", which I can't see any problem with as a non
                      >native English speaker ... must be something local - indeed that was
                      >the only comment I would find unreasonable).[/color]
                      <snip>

                      Some common dialects spoken in England use Hey like this :

                      Hey, you! Get your hands off my car/pheasants/daughter/... !

                      That is, it's a negative exclamation. Other dialects of English use it
                      differently (as in 'ey Up! and Whey Hey!, which are positive). A
                      sensible person wouldn't object to Hey.

                      "Hi" is safer.

                      John
                      --
                      John Harris

                      Comment

                      • John G Harris

                        #12
                        Re: document.lastMo dified

                        In article <c73gjh029t@new s4.newsguy.com> , Matt Kruse
                        <newsgroups@mat tkruse.com> writes

                        <snip>[color=blue]
                        >perfectly standards-compliant, backwards-compatible, user-friendly, and
                        >internationa l[/color]

                        These are useful things to be. Remember that replies go to thousands of
                        people, not just the original question asker. Some of them haven't had a
                        chance yet to think about these topics. Where else will they find out?

                        <snip>[color=blue]
                        >the same
                        >proficiency in the language that he has[/color]
                        <snip>

                        Your opinion; but not mine.

                        John
                        --
                        John Harris

                        Comment

                        • Thomas 'PointedEars' Lahn

                          #13
                          Re: document.lastMo dified

                          Matt Kruse wrote:
                          [color=blue]
                          > heh, welcome to c.l.j., a helpful newsgroup with a lot of good information,
                          > but home of several "elitist" people with attitudes. [...][/color]

                          *PLONK*

                          Comment

                          Working...