Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cell background!?!? 1

Status
Not open for further replies.

iLy54

Programmer
Sep 5, 2002
33
0
0
ZA
i have this script the forms a calender of the entire year.

<script language=&quot;javascript&quot;>
<!--
// fill the month table with column headings
function day_title(day_name){
document.write(&quot;<TD ALIGN=center WIDTH=35>&quot;+day_name+&quot;</TD>&quot;)
}
// fills the month table with numbers
function fill_table(month,month_length)
{
day=1
// begin the new month table
document.write(&quot;<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=%3><TR>&quot;)
document.write(&quot;<TD COLSPAN=7 ALIGN=center><B>&quot;+month+&quot; &quot;+year+&quot;</B><TR>&quot;)
// column headings
day_title(&quot;Sun&quot;)
day_title(&quot;Mon&quot;)
day_title(&quot;Tue&quot;)
day_title(&quot;Wed&quot;)
day_title(&quot;Thu&quot;)
day_title(&quot;Fri&quot;)
day_title(&quot;Sat&quot;)
// pad cells before first day of month
document.write(&quot;</TR><TR>&quot;)
for (var i=1;i<start_day;i++){
document.write(&quot;<TD>&quot;)
}
// fill the first week of days
for (var i=start_day;i<8;i++){
document.write(&quot;<TD ALIGN=center>&quot;+day+&quot;</TD>&quot;)
day++
}
document.write(&quot;<TR>&quot;)
// fill the remaining weeks
while (day <= month_length) {
for (var i=1;i<=7 && day<=month_length;i++){
document.write(&quot;<TD ALIGN=center>&quot;+day+&quot;</TD>&quot;)
day++
}
document.write(&quot;</TR><TR>&quot;)
// the first day of the next month
start_day=i
}
document.write(&quot;</TR></TABLE><BR>&quot;)
}
// end hiding -->

</script>

<script language=&quot;javascript&quot;>

// CAHNGE the below variable to the CURRENT YEAR
year=2001

// first day of the week of the new year
today= new Date(&quot;January 1, &quot;+year)
start_day = today.getDay() + 1 // starts with 0
fill_table(&quot;January&quot;,31)
fill_table(&quot;February&quot;,29)
fill_table(&quot;March&quot;,31)
fill_table(&quot;April&quot;,30)
fill_table(&quot;May&quot;,31)
fill_table(&quot;June&quot;,30)
fill_table(&quot;July&quot;,31)
fill_table(&quot;August&quot;,31)
fill_table(&quot;September&quot;,30)
fill_table(&quot;October&quot;,31)
fill_table(&quot;November&quot;,30)
fill_table(&quot;December&quot;,31)
</script>


but i can't get it to do what i want. what i want is to be able to change the background of a particular cell whose date is say the 10th of every month.
i jus cant figure out a solution.
is there anyone that can help me with this one?
thanx, -Mon3y is the r00t of all evil and every man needs roots-
 
how about...

***

while (day <= month_length) {
for (var i=1;i<=7 && day<=month_length;i++){
if (day==10) {document.write(&quot;<TD ALIGN=center bgcolor=red>&quot;+day+&quot;</TD>&quot;);} //here's the check
else {document.write(&quot;<TD ALIGN=center>&quot;+day+&quot;</TD>&quot;);}
day++
}

***

something like that?

- g
 
thanx that helpd. -Mon3y is the r00t of all evil and every man needs roots-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top