PDA

View Full Version : Help pleeeze in changing hyperlink fonts in .js


bazz
04-29-2003, 03:46 PM
Hi guys.

Ive got this javascript which is a calendar script. I have configured it to match my requirements but there is one thing I cant figure out.

i need to make the hyperlink text change from my browsers default blues and dark reds to a consistent colour say grey (or #888888)

Can anyone please show me where i should change the text and what text I should insert. I've tried the usual font color="#888888" link="#888888" alink="#888888" in several places but noe of them work either on their own or when all are added.

gettin frustrated now.

thanks

OI here's the relevant part of the script



// begin table for calendar
target.document.open()
calendar = "<html><head><title>calendar</title></head><body bgcolor=#ffffff topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>"
calendar +="<table border=0 cellspacing=0 cellpadding=0 width=167>"
calendar +="<tr valign=top height=21 width=166>"

var endday = getDaysInMonth(mth, year)
var goPrevMonth = prevMonth(mth)
var goNextMonth = nextMonth(mth)
var nextYear = changeYear("next",mth,parseInt(year))
var prevYear = changeYear("prev",mth,parseInt(year))

//writes month and next and back buttons
calendar +="<td width=24 height=21 bgcolor=#336633><a href=\"javascript:opener.generateCalendar(self, " + goPrevMonth + ", " + prevYear + ",'" + checkInOrOut + "')\"><img src='../../images/calendar_left_arrow.gif' width=24 height=21 border=0></a></td>"
calendar +="<td width=118 height=21 bgcolor=#336633 align='center'><STRONG><FONT COLOR='#D2F3DA' SIZE='2' FACE='Arial,Helvetica'>" + monthName[mth] + " " + year + "</FONT></STRONG></td>"
calendar +="<td width=24 height=21 bgcolor=#336633><a href=\"javascript:opener.generateCalendar(self, " + goNextMonth + ", " + nextYear + ", '" + checkInOrOut + "')\"><img src='../../images/calendar_right_arrow.gif' width=24 height=21 border=0></a></td></tr>"
calendar +="</table></body></html>"
target.document.close();

//writes in the day of the week labels
calendar +="<table border=0 cellspacing=0 cellpadding=0 width=167>"
calendar +="<tr align=center>"
calendar +="<td width=167 align=center><img src='../../images/calendar_days.gif' border=0></td>"

calendar +="</tr></table>"

// get the first day of the month
thedate = new Date (year, mth, 1);
firstDay = thedate.getDay()

selectedmonth = mth;
var today = new Date();
var thisyear = today.getYear() + 1900;
selectedyear = year;

var lastDay = (endday + firstDay+1);

calendar +="<table border=0 cellspacing=1 cellpadding=0 width=168><tr>";
for (var i = 1; i < lastDay; i++)
{
if (i <= firstDay)
{
// 'empty' boxes prior to first day
calendar +="<td bgcolor='#336633'>&nbsp;</td>";
}
else

{
// enter date number
var lookd = today.getDate();
var lookm = today.getMonth();
if ( (selectedmonth == lookm) && (lookd == (i-firstDay)) && (selectedyear == today.getFullYear()) ) {
calendar +="<td align=center bgcolor='#336633' size='2' face='Arial,Helvetica'><a href=\"JavaScript:opener.closeCalendar("
+ selectedmonth
+ ", "
+ (i-firstDay)
+ ", "
+ selectedyear
+ ", '"
+ checkInOrOut
+ "');self.close()\"> "
+ (i-firstDay)
+ "</a></FONT>&nbsp;</td>\n"
} else {
calendar +="<td align=center bgcolor='#D2F3DA'><FONT COLOR='#336633' SIZE='2' FACE='Arial,Helvetica'><a href=\"JavaScript:opener.closeCalendar("
+ selectedmonth
+ ", "
+ (i-firstDay)
+ ", " + selectedyear
+ ", '"
+ checkInOrOut
+ "');self.close()\"> " + (i-firstDay) + "</a></FONT>&nbsp;</td>\n"
}}
//must start new row after each week
if (i % 7 == 0 && i != lastDay)
{
calendar +="</tr><tr>"
}
}
calendar +="</tr></table>"

target.document.write(calendar);
target.document.close()
}

// ******************************************************
// FUNCTION closeCalendar
// changes date field when a date is clicked
// ******************************************************

bazz
04-29-2003, 03:51 PM
Well I'm not surprised it shows embarrassment. Its been plain bl$$dy troublesome and I've just made it public!! :D

tamienne
04-29-2003, 03:51 PM
have you tried
href=\"JavaScriptpener.closeCalendar("
+ selectedmonth
+ ", "
+ (i-firstDay)
+ ", " + selectedyear
+ ", '"
+ checkInOrOut
+ "');self.close()\" STYLE=\'color:888888\'>

pretty much adding the style in the link. you probably want to make it in css though and use a class.

bazz
04-29-2003, 09:35 PM
excellent! thank alot it works just like I should - very well. :thumbsup: