PDA

View Full Version : How do I change the font properties of an array for a datestamp?


danielk1985
08-27-2002, 06:49 PM
I'm using JavaScript to display the date for viewers of a website. I found the following code on the internet:

(Entered into <HEAD>)

<SCRIPT language=Javascript>
var today_date= new Date();
var month=today_date.getMonth();
var today=today_date.getDate();
var year=today_date.getYear();

var months = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December");
</SCRIPT>

(Entered in <BODY>)

<script language="JavaScript">
document.write(today + " " + months[month] + " " + year)
</script>

This worked fine but I decided I wanted to change the display properties from the default Times New Roman face in black to a Verdana face in grey, and smaller font. I tweaked the coding to change the properties for the year and today variables, but i couldn't figure out how to alter the display properties for the month name. Since its an array unlike the two variables, how i reformatted the others just won't work here- PLEASE HELP!

Thanks in advance

Mr J
08-27-2002, 07:51 PM
Try this


<script language="JavaScript">
document.write("<font face='Comic Sans MS'>" +today + " " + months[month] + " " + year+"</font>")
</script>

danielk1985
08-27-2002, 08:04 PM
Thanx alot! I tried it and yeah- it worked :-) I owe you one!