JavaScript: Today's Date
This one's easy. All you need for this one is to insert the following
text:
<SCRIPT LANGUAGE="Javascript">
<!--
// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
"Thursday","Friday","Saturday");
// Array of month Names
var monthNames = new Array(
"January","February","March","April","May","June","July",
"August","September","October","November","December");
var now = new Date();
document.write(dayNames[now.getDay()] + ", " +
monthNames[now.getMonth()] + " " +
now.getDate() + ", " + now.getFullYear());
// -->
</SCRIPT>
into the <BODY> of your web page wherever you want the date to
show up. You can format the text if you like by putting the formatting
tags (or CSS tags) on either side of the <SCRIPT> tags.
The result looks like this:
The script reflects the date on your visitor's computer, not the date on
the server.
|