473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

adding last modified date at end of webpage

105 100+
Hi everyone,

Thank you in advance for your help on this!!

I have the below javascript at the bottom of my SHTML webpage. It gives and "undefined NaN" error when I test it. However, the code works fine in HTML. I have to keep the webpage in SHTML format due to includes... can someone help me modify my javascript so it will work?

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language=JavaScript type=text/javascript>
  2.                                                 <!-- Begin
  3.               var days = new Array(8);
  4.               days[1] = "Sunday";
  5.               days[2] = "Monday";
  6.               days[3] = "Tuesday";
  7.               days[4] = "Wednesday";
  8.               days[5] = "Thursday";
  9.               days[6] = "Friday";
  10.               days[7] = "Saturday";
  11.               var months = new Array(13);
  12.               months[1] = "January";
  13.               months[2] = "February";
  14.               months[3] = "March";
  15.               months[4] = "April";
  16.               months[5] = "May";
  17.               months[6] = "June";
  18.               months[7] = "July";
  19.               months[8] = "August";
  20.               months[9] = "September";
  21.               months[10] = "October";
  22.               months[11] = "November";
  23.               months[12] = "December";
  24.               var dateObj = new Date(document.lastModified)
  25.               var wday = days[dateObj.getDay() + 1]
  26.               var lmonth = months[dateObj.getMonth() + 1]
  27.               var date = dateObj.getDate()
  28.               var fyear = dateObj.getYear()
  29.               if (fyear < 2000) 
  30.               fyear = fyear + 1900
  31.               document.write("Last modified on " + lmonth + " " + date + ", " + fyear)
  32.               // End -->
  33.                                             </SCRIPT>
  34.  
May 6 '10 #1
5 2622
Dormilich
8,658 Expert Mod 8TB
where does it give that error?
May 6 '10 #2
jmarcrum
105 100+
I created a page called test.shtml. The error is like this, "Last modified on undefined NaN, NaN"
May 6 '10 #3
drhowarddrfine
7,435 Expert 4TB
Wrong board.
May 6 '10 #4
Dormilich
8,658 Expert Mod 8TB
it looks like the creation of the Date object failed. what does document.lastModified give you?
May 6 '10 #5
jmarcrum
105 100+
nothing happened when i used document.lastModified. It was just a blank webpage. However, I changed browsers and it worked fine. I was using Google Chrome. The code works fine in IE or Firefox. Not sure why??
May 7 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rich Pasco | last post by:
The PERL statement I use to open a text file looks like this: open(HANDLE, $filename); Now how can I get the "last modified" date of that file? I need a solution that works the same under Windows...
11
by: Dennis Marks | last post by:
There seems to be a major program with the automatic display of the last modified date. Using the javascript "document.lastModified" sometimes returns the correct date and sometimes 1 Jan 1970...
5
by: Boniface Frederic | last post by:
Hi, Is it possible to know the last modified date of a text file in javascript. Any help would be appreciated. Thanks. Fred.
4
by: IdleBrain | last post by:
Hello All, Is it possible to obtain the last Modified date for the source code from within the application? If yes, please let me know how it is done.
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format Last Modified date with javascript...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format the Last-Modified date with javascript?...
7
by: mariyana | last post by:
How can we get the last accessed date and the last modified date of a file using VB6
1
by: sudkum | last post by:
Hi, i am just trying to get the last modified date/time of a trx file trough batch file is this possible. I need this to use in copy statement like, i just wanted to copy newly...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.