View Full Version : Help in changing date scripts font, bold and size.

12-16-2002, 04:26 PM
Im designing a page in DW4 and am using the following script to automatically insert todays date. The page font which I'm using is Comic Sans MS, bold, size 2, but when the page loads, the date is displayed in what appears to be Times New Roman. I've tried different mixes to insert the HTML <b><font face="Comic Sans MS" size="2"> </font></b> but cant get it to function on the date. Any help would be appreciated. CODE FOLLOWS -

<script language="Javascript"><!--
// ***********************************************
// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;
// Join it all together
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
date + ", " +
(fourdigits(now.getYear())) ;

// Print out the data.
document.write(today+ ".");

12-16-2002, 05:53 PM
You could use CSS in your htm to make all or just some of the text on your page whatever font and style you want.

In your <head> tag type

<style Type="text/css">
body{color: #0000ff; font-family: "Comic Sans MS"; font-size: 2px; font-weight: bold;}

This should change all the text on your page to Comic Sans MS and blue. There are a lot of other nice options you can set with CSS.

First though take out the <font> tags around your date script.

12-16-2002, 06:15 PM
Thanks Frank

That sounds an excellent idea, except that ;

1 I've not really worked with CSS before, &

2 That would make everything on the page default to that size, etc (I think) and thats not what I want to do.

Is it possible just to set the date script please?


12-16-2002, 06:55 PM
It's ok if your not use to CSS.

Place this before your script.
<div style= "font-family: Comic Sans MS; font-weight: bold; font-size: 20px;">

And this after</div>

The tag does not need to be "div" it could just as easily be "p".
You may want to play around with the font-size to get it the right size, I looked at size 2 and its really small. If you want to use it just type font-size: 2;

Good luck.

12-16-2002, 07:32 PM
i think "font-size: 10pt;" is more or less equivalent of <font size="2">

try searching for "font size"... it should have some interesting threads on the subject. :thumbsup:

12-16-2002, 08:13 PM
Thanks very much Frank and Redhead - it worked a treat with size 15.

Its great to know that this sort of support exists on the web and in this forum.

BTW, Frank, I'll give some thought to CSS. I tried your code and it worked as you suggested. That was my back-up plan.:)