Click to See Complete Forum and Search --> : Problem displaying Last Updated line


mattmac_ca
September 7th, 2002, 12:59 PM
I am trying to use the following java script code on my web site

var dateModified = document.lastModified;
mydate = dateModified.slice(0,10);
document.write("<b>Last updated: " + mydate + "</b>");

When I try and view the web page, I get the following error

Error. 'document.all.modified' is null or not an object

Now, the code still works, it does display the last updated date, but, i would like to know what is causing this error.

Thank you
Matthew MacPherson

Zvona
September 8th, 2002, 07:42 AM
Originally posted by mattmac_ca
I am trying to use the following java script code on my web site

var dateModified = document.lastModified;
mydate = dateModified.slice(0,10);
document.write("<b>Last updated: " + mydate + "</b>");

When I try and view the web page, I get the following error

Error. 'document.all.modified' is null or not an object

Now, the code still works, it does display the last updated date, but, i would like to know what is causing this error.

Thank you
Matthew MacPherson
You're referencing to an invalid object. Please post the whole script and I'll advice you further.

mattmac_ca
September 8th, 2002, 07:12 PM
Thanks Zvona, I took a look at the script for the page, and I was trying to reference an object that did not exist any more. Thank you for the help.
Matthew MacPherson