Forum Moderators: open

Message Too Old, No Replies

Calendar

Help with javascript calendar

         

idyll

12:53 pm on May 31, 2004 (gmt 0)

10+ Year Member



Hi,
I've never used javascript before and am quite new to the whole website building.
I've created a html based site which I would like to add a simple javascript calendar to.
I searched the web and found this one:
[javascript.internet.com...]
I got it working exactly how it said and managed to change all the colours.
I placed the calendar in a table underneath the navigation bar, but due to the size of the font it messes up all the alignments - I was wondering if there was some way to change the calendar's font to the smallest possible Arial?
Cheers

Alternative Future

1:30 pm on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld idyll,

Locate the following code in the external file you have created called calender.js and you can either inline style or call on a style class for the surrounding td elements. I have included an inline style of font-size 8 in the below example.

var TR_start = '<TR>';
var TR_end = '</TR>';
var highlight_start = '<TD WIDTH="30"><TABLE CELLSPACING=0 BORDER=1 BGCOLOR=DEDEFF BORDERCOLOR=CCCCCC><TR><TD WIDTH=20 style="font-size:8pt"><B><CENTER>';
var highlight_end = '</CENTER></TD></TR></TABLE></B>';
var TD_start = '<TD WIDTH="30" style="font-size:8pt"><CENTER>';
var TD_end = '</CENTER></TD>';

HTH,

-George

idyll

3:26 pm on May 31, 2004 (gmt 0)

10+ Year Member



Thanks a lot - exactly what I needed :D

idyll

3:53 pm on May 31, 2004 (gmt 0)

10+ Year Member



Right, I got the main dates and days sorted - just still having a problem with the Month at the top.
As far as I can figure out it's configured in this bit:

/* BEGIN CODE FOR CALENDAR
NOTE: You can format the 'BORDER', 'BGCOLOR', 'CELLPADDING', 'BORDERCOLOR'
tags to customize your calendar's look.*/

cal = '<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR=BBBBBB><TR><TD>';
cal += '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2>' + TR_start;
cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '" BGCOLOR="#9BCFEC"><TD WIDTH="30" style="font-size:8pt"><CENTER><B>';
cal += month_of_year[month] + ' ' + year + ' </B>' + TD_end + TR_end;
cal += TR_start;

but I have no idea where to put the style bit in?
any ideas?
Cheers

idyll

3:56 pm on May 31, 2004 (gmt 0)

10+ Year Member



Sorry - this is the code of the bit i need to chnage the font size of:

cal = '<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR=BBBBBB><TR><TD>';
cal += '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2>' + TR_start;
cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '" BGCOLOR="#9BCFEC"><CENTER><B>';
cal += month_of_year[month] + ' ' + year + ' </B>' + TD_end + TR_end;
cal += TR_start;

Alternative Future

3:58 pm on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi idyll,

This should do the trick!

>>cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '" BGCOLOR="#EFEFEF" style="font-size:8pt"><CENTER><B>';

-George

idyll

8:02 pm on May 31, 2004 (gmt 0)

10+ Year Member



Thanks alot for the speedy and helpful replies!