document.lastModified

?

*.*

Hey-

I seem to be having a problem with the document.lastModified 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.lastModified+ ", ");

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
 
S

Snowpurr

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.

==============start=============
<head>
<title>Document Title</title>
<script type="text/javascript">
<!--
function footer()
{
document.write("Author: Me, ");
document.write("Created on 4/5/2004"+", ");
document.write("Last Modified:" +document.lastModified+ ", ");
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=====
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen
in news:comp.lang.javascript said:

Hardly a polite beginning.
I seem to be having a problem with the document.lastModified 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.

The way it is suppose to work is that it returns the date and time at
which the document was last modified.

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

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"+", ");

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.

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

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.

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

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.
 
?

*.*

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.
 
L

Lasse Reichstein Nielsen

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!

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).
By the way thanks for answering my question. Your insight was so
helpful that you solved my problem ten times over.

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

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

/L
 
M

Matt Kruse

*.* said:
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.

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.
 
?

*.*

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




Hardly a polite beginning.-> That was out of line
I seem to be having a problem with the document.lastModified
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.

The way it is suppose to work is that it returns the date and time at
which the document was last modified.

"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

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"+", ");

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.

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

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

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

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.lastModified,
please let me know.
 
?

*.*

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-

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.
 
J

John G Harris

(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).
<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
 
J

John G Harris

perfectly standards-compliant, backwards-compatible, user-friendly, and
international

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?

the same
proficiency in the language that he has
<snip>

Your opinion; but not mine.

John
 
T

Thomas 'PointedEars' Lahn

Matt said:
heh, welcome to c.l.j., a helpful newsgroup with a lot of good information,
but home of several "elitist" people with attitudes. [...]

*PLONK*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top