Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-27-2008, 05:32 AM   #1 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 2
Default Auto-Date

I have a couple of situations where I am tired of updating a date and would like to do it automatically. I am not an expert programmer, but I am pretty good at inserting spaghetti code and making already existing code work in my website; however, I haven't been able to find what I need for this:

Code:
       <select name="menuopts" onChange="goDestination(document.mymenu.menuopts.options[document.mymenu.menuopts.options.selectedIndex].value)">
       <option>Quick Links...</option>
       <option value="guestbook.html">Community</option>
       <option value="credits.html">Credits</option>
       <option value="pages/Sep2008.html">Current Diary Page</option>
       <option value="main.html">Main Page</option>
       </select>
Is it possible to dynamicly generate the spot that shows Sep2008 to show the current MmmYYYY?

Here is my second question:
I have a line that looks like this on the same page:

Code:
   <font face="Comic Sans MS" size="1">Last Updated September 14th, 2008</i></font></p>
I would like the date here to be whatever date a specific file was modified. This file is located at "pages/site-index.html" in relation to the page that has this code.

Any help is greatly appreciated. Thanks a bundle!
Lotus123 is offline   Reply With Quote
Old 09-28-2008, 04:02 AM   #2 (permalink)
Silver Member
 
wetgravy's Avatar
 
Join Date: Sep 2008
Posts: 119
Send a message via AIM to wetgravy
Default

Sadly most of the scripting i know for that is meant for sites with admin support or php/database updating capabilities ... if you want a site that has auto capabilities ... look to a CMS.
wetgravy is offline   Reply With Quote
Old 09-28-2008, 04:36 AM   #3 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 2
Default

I have pretty much whatever I need on the site...including access to the server itself, if necessary.
Lotus123 is offline   Reply With Quote
Old 09-29-2008, 01:48 AM   #4 (permalink)
Moderator
 
jnjc's Avatar
 
Join Date: Jun 2008
Posts: 365
Default

To make the link dynamic is pretty easy, this should do what you need:

Code:
<script type="text/javascript">
function getMonthFile() {
var months = new Array(12);
today = new Date();
months[0] = "Jan";
months[1] = "Feb";
months[2] = "Mar";
months[3] = "Apr";
months[4] = "May";
months[5] = "Jun";
months[6] = "Jul";
months[7] = "Aug";
months[8] = "Sep";
months[9] = "Oct";
months[10] = "Nov";
months[11] = "Dec";

return "pages/" + months[today.getMonth()] + today.getFullYear() + ".html";

}

</script>



<body>
<a  onmouseover="this.href=getMonthFile();" >test</a>
</body>
To display a date and time based on the modification date/time of a file is not so straight forward. JS code is executed client side and I am not sure if you can access the file mod information client side. You may need to come up with a server side script to do this...

HTH,
JC
jnjc is offline   Reply With Quote
Old 10-10-2008, 01:53 PM   #5 (permalink)
joe
Bronze Member
 
Join Date: Aug 2008
Location: Dallas, Tx
Posts: 83
Default

I think with what you're wanting you'll need to go to a server side language. I don't think jnjc's suggestion will help because you're wanting something to be there when the page loads and javascript really can't do that to my knowledge.
joe is offline   Reply With Quote
Old 10-18-2008, 08:29 AM   #6 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 9
Default

use document.lastModified parse it, and write the date the way you want it, it is not too complicated
Phidev is offline   Reply With Quote
Old 11-13-2008, 04:16 AM   #7 (permalink)
Silver Member
 
Geodun1's Avatar
 
Join Date: Nov 2008
Location: New Mexico
Posts: 145
Default

Quote:
Originally Posted by joe View Post
I think with what you're wanting you'll need to go to a server side language. I don't think jnjc's suggestion will help because you're wanting something to be there when the page loads and javascript really can't do that to my knowledge.
JNJC's suggestion SHOULD work fine for this set up. It builds the link based on the month and year, which is what our friend is looking for.
Geodun1 is offline   Reply With Quote
Reply

Tags
dates

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:02 AM.


Computer Forum - TechZine - Webpage Design

 
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.