English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I notice on the bottom of some webpages something like, "This webpage was last updated on....." Is this an automatic code or do they do it manually? If automatic, who do they do it?

2006-09-20 03:07:00 · 3 answers · asked by ton 2 in Computers & Internet Programming & Design

3 answers

This is a feature that is normally done automatically from within the HTML editor like Frontpage. You can manually add this to your pages as well. Just change the date when you change the page.

2006-09-20 03:12:10 · answer #1 · answered by Anonymous · 0 0

/*
This javascript displays the current date in an html page
It does not self refresh and will display the local system's
interpretation of the date and time when the page is first loaded

The script works as a javascript function. There are three aspects
to installing it:

1) Calling the this external javascript in the head of your html document
2) Placing three lines of code into the body of the html to display the date
3) Passing the correct argument to the function to display the date in the
format you want

Step (1)

Place the code in the line below, into the head of your html code

NOTE that it does not matter if you have other internal or external javascripts
you can call as many as you like

Step (2)

In your html document, in the location you wish to display the current date,
place the following three lines of code:


Step (3)

Decide on how you want your date to be formatted, and then follow the instructions
below to tell this script to format the date your way. We achieve this by changing
the argument (number inside the brackets) that we pass to the javascript
function. Let us assume that today is Wednesday the 20th of April 2005.
We can display the date in the following ways:

1) 2005/04/20
2) 2005/4/20
3) 20/04/2005
4) 20/4/2005
5) 04/20/2005
6) 4/20/2005
7) 20/04/05
8) 20/4/05
9) 20 Apr 05
10) 20th Apr, 05
11) Wed 20th Apr, 05
12) Wed 20th Apr, 2005
13) Wednesday 20th April, 2005
14) Wednesday 20th April
15) April 20
16) April 20th
17) 20th April
18) 20th of April

For example if we liked format number 10 then we would write displaydate(10)

*/

function displaydate(myOption)
{
if ((myOption > 18) || (myOption < 1))
{
alert("Function argument out of range\nNo date will be displayed");
}
else
{
// Interrogate the system for the local time/date
var time = new Date();

// Get the number of the day of the week
var daytoday = time.getDay();

// Initialize an array with the full day names
var fullDayName = new Array(7);
fullDayName[0]="Sunday";
fullDayName[1]="Monday";
fullDayName[2]="Tuesday";
fullDayName[3]="Wednesday";
fullDayName[4]="Thursday";
fullDayName[5]="Friday";
fullDayName[6]="Saturday";


// Assign the current full day name to the day number
var todayFullDayName = fullDayName[daytoday];

// Do the same thing only with abbreviated day names

var abbrDayName = new Array(7);
abbrDayName[0]="Sun";
abbrDayName[1]="Mon";
abbrDayName[2]="Tue";
abbrDayName[3]="Wed";
abbrDayName[4]="Thu";
abbrDayName[5]="Fri";
abbrDayName[6]="Sat";

// Assign the current abbreviated day name to the day number
var todayAbbrDayName = abbrDayName[daytoday];
// Now we repeat this dual process for month names
var fullMonthName = new Array(13);
fullMonthName[1] = "January";
fullMonthName[2] = "February";
fullMonthName[3] = "March";
fullMonthName[4] = "April";
fullMonthName[5] = "May";
fullMonthName[6] = "June";
fullMonthName[7] = "July";
fullMonthName[8] = "August";
fullMonthName[9] = "September";
fullMonthName[10] = "October";
fullMonthName[11] = "November";
fullMonthName[12] = "December";
var monthOfYear = time.getMonth();
var thisMonthFullName = fullMonthName[monthOfYear + 1];

// and again for abbreviated month names

var abbrMonthName = new Array(13);
abbrMonthName[1] = "Jan";
abbrMonthName[2] = "Feb";
abbrMonthName[3] = "Mar";
abbrMonthName[4] = "Apr";
abbrMonthName[5] = "May";
abbrMonthName[6] = "Jun";
abbrMonthName[7] = "Jul";
abbrMonthName[8] = "Aug";
abbrMonthName[9] = "Sep";
abbrMonthName[10] = "Oct";
abbrMonthName[11] = "Nov";
abbrMonthName[12] = "Dec";
var thisMonthAbbrName = abbrMonthName[monthOfYear + 1];

var longNumericMonth = monthOfYear + 1;
var shortNumericMonth = monthOfYear + 1;
if (shortNumericMonth < 10)
{
longNumericMonth = "0" + shortNumericMonth;
}

// Get the day of the month component of the date
var numericDayOfMonth = time.getDate();
var suffixDayOfMonth;
var shortNumericDayOfMonth = numericDayOfMonth;
var longNumericDayOfMonth = numericDayOfMonth;

if (numericDayOfMonth < 10)
{
longNumericDayOfMonth = "0" + numericDayOfMonth;
}

// If we want our date to appear as "20th March", we can't just
// tack "th" on to the end of the date as this would look messy on the
// 1st 2nd & 3rd etc of each month. So we need to do some checking before
// assigning a fitting suffix

if ((numericDayOfMonth == 1) || (numericDayOfMonth == 21) || (numericDayOfMonth == 31))
{
suffixDayOfMonth = numericDayOfMonth + "st ";
}
else if ((numericDayOfMonth == 2) || (numericDayOfMonth == 22))
{
suffixDayOfMonth = numericDayOfMonth + "nd ";
}
else if ((numericDayOfMonth == 3) || (numericDayOfMonth == 23))
{
suffixDayOfMonth = numericDayOfMonth + "rd ";
}
else
{
suffixDayOfMonth = numericDayOfMonth + "th ";
}

// Get the numeric year component
var year = time.getYear();
var shortYear;
var longYear;
// For non Y2K compliant Browsers
if ((year > 100) && (year < 1000))
{
shortYear = year - 100;
longYear = 2000 + shortYear;
}
else
{
longYear = year;
shortYear = year - 2000; //note that this code is not Y3K compliant ;-)
}

if (shortYear < 10)
{
shortYear = "0" + shortYear;
}

switch(myOption)
{
case 1:output = longYear + "/" + longNumericMonth + "/" + longNumericDayOfMonth; break;
case 2:output = longYear + "/" + shortNumericMonth + "/" + shortNumericDayOfMonth; break;
case 3:output = longNumericDayOfMonth + "/" + longNumericMonth + "/" + longYear; break;
case 4:output = shortNumericDayOfMonth + "/" + shortNumericMonth + "/" + longYear; break;
case 5:output = longNumericMonth + "/" + longNumericDayOfMonth + "/" + longYear; break;
case 6:output = shortNumericMonth + "/" + shortNumericDayOfMonth + "/" + longYear; break;
case 7:output = longNumericDayOfMonth + "/" + longNumericMonth + "/" + shortYear; break;
case 8:output = shortNumericDayOfMonth + "/" + shortNumericMonth + "/" + shortYear; break;
case 9:output = longNumericDayOfMonth + " " + thisMonthAbbrName + " " + shortYear; break;
case 10:output = suffixDayOfMonth + " " + thisMonthAbbrName + " " + shortYear; break;
case 11:output = todayAbbrDayName + " " + suffixDayOfMonth + " " + thisMonthAbbrName + ", " + shortYear; break;
case 12:output = todayAbbrDayName + " " + suffixDayOfMonth + " " + thisMonthAbbrName + ", " + longYear; break;
case 13:output = todayFullDayName + " " + suffixDayOfMonth + " " + thisMonthFullName + ", " + longYear; break;
case 14:output = todayFullDayName + " " + suffixDayOfMonth + " " + thisMonthFullName; break;
case 15:output = thisMonthFullName + " " + longNumericDayOfMonth; break;
case 16:output = thisMonthFullName + " " + suffixDayOfMonth; break;
case 17:output = suffixDayOfMonth + " " + thisMonthFullName; break;
case 18:output = suffixDayOfMonth + " of " + thisMonthFullName;
}
document.write(output);
}
}

2006-09-20 03:13:08 · answer #2 · answered by teef_au 6 · 0 0

usually, pages eith that kind of mark are power by a cms (content management system). that means that all usefull content is stored into a database and when tehy need to change it they log in into an interface (similar to a desktop app but webbased) witch connects to the database and change the content. the web app update the date too

2006-09-20 03:38:47 · answer #3 · answered by the_man_behind_the_desk 2 · 0 0

fedest.com, questions and answers