Forum: Geek Forum
Topic: javascript help pls?
started by: masher

Posted by masher on Mar. 20 2001,23:20
I have a small script at the bottom of the pages in my website to put the date that the file was last edited


<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from non-Javascript browsers
document.write("<FONT FACE=\"arial\" SIZE=1>");
document.write('Last Updated ' + document.lastModified);

// Stop hiding from non-JavaScript Browsers -->
</SCRIPT>


The problem is that it doesn't work, something to do with the server settings...

quote:

The lastModified property is derived from the HTTP header data sent by the web server. Servers generally
obtain this date by examining the file's modification date.

The last modified date is not a required portion of the header, and some servers do not supply it. If the server
does not return the last modified information, JavaScript receives a 0, which it displays as January 1, 1970 GMT.


That was from < http://developer.netscape.com/docs/manuals/js/client/jsref/document.htm#1193811 >

Is there another way of automatically rendering the date that the file was last edited? I don't feel like changing the date everytime I edit the file...

------------------
"The theory of gravitation is not responsible for people falling in love." - Einstein


Posted by hal0 on Mar. 21 2001,00:56
quote:
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from non-Javascript browsers
document.write("<FONT FACE=\"arial\" SIZE=1>");
document.write('Last Updated ' + document.lastModified);

// Stop hiding from non-JavaScript Browsers -->
</SCRIPT>


guessing here.. i'm not good at java.. cuz i hate it, but the first document.write has " quotes, while the second uses ' quotes.. try changing the second to " quotes

------------------
"that's even better! hot lesbian witches.. think about it, it's fucking genius!" - charlie sheen


Posted by masher on Mar. 21 2001,02:34
the actual script itelf works. Its just that the server doesn't provide the information for the script to render the correct date.

I'm wondering if there is another way (javascript or otherwise) to do it, or do I have to put in the date manually?

------------------
"The theory of gravitation is not responsible for people falling in love." - Einstein


Posted by hal0 on Mar. 21 2001,21:52
so it does show a date, but it doesn't show the date you want?

------------------
"that's even better! hot lesbian witches.. think about it, it's fucking genius!" - charlie sheen


Posted by masher on Mar. 24 2001,11:13
Netscape shows January 1, 1970 GMT.
IE shows the time that the page loaded.

------------------
"The theory of gravitation is not responsible for people falling in love." - Einstein


Posted by porn_dealer on Mar. 25 2001,06:28
Better yet, if your web server runs PHP, you can rename your page to .php and run the following code (insert it wherever you want it to go on the page):
code:

<?php
$lastmod = date("F d Y H:i:s", getlastmod());
echo "Last Modified".$lastmod;
?>

That should work.

------------------
Only you can prevent forum fires.


Powered by Ikonboard 3.1.4 © 2006 Ikonboard