PDA

View Full Version : calendar issues



newfoundnoise82
Feb 10th, 2005, 05:51 AM
i dunno where exactly to post this and i'm purely guessing that this is the right part. anyways i use a table to create a small calendar on my <a href="http://www.geocities.com/newfoundnoise82" target="_blank">site</a> and basically i want to somehow modify it to highlight the current day. any suggestions as to how? my code is below for the table.



<//---------CALENDAR----------//>
<table style="border: 0px solid; border-color:#ffffff; border-collapse:collapse" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3EBC4" width="125" bordercolor="#111111">
<tr>
<td align="center"><font size="1">s</td>
<td align="center"><font size="1">m</td>
<td align="center"><font size="1">t</td>
<td align="center"><font size="1">w</td>
<td align="center"><font size="1">t</td>
<td align="center"><font size="1">f</td>
<td align="center"><font size="1">s</td>
</tr>
<tr>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">1</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">2</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">3</a></td>
<td align="center"><font size="1">4</td>
<td align="center"><font size="1">5</td>
</tr>
<tr>
<td align="center"><font size="1">6</td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">7</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school/cis180 #2">8</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school/jennifer bday">9</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">10</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="cis205 #4-6/cis205 midterm (5-8)">11</a></td>
<td align="center"><font size="1">12</td>
</tr>
<tr>
<td align="center"><font size="1">13</td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school/cis186 #3/valentines day/bright eyes @ the orpheum">14</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">15</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school/cis186 test #1">16</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school/cis180 #3/cis180 test 1">17</a></td>
<td align="center"><font size="1">18</a></td>
<td align="center"><font size="1">19</a></td>
</tr>
<tr>
<td align="center"><font size="1">20</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="presidents day">21</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">22</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">23</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">24</a></td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="cis205 #7-8">25</a></td>
<td align="center"><font size="1">26</td>
</tr>
<tr>
<td align="center"><font size="1">27</td>
<td align="center"><font size="1"><a href="calendar.htm" target="main" title="school">28</a></td>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"></td>
<td align="center"><font size="1"></td>
</tr>
</table>

Willy Duitt
Feb 10th, 2005, 07:53 AM
For the most part this should fit your needs but all those font tags within the data cells make things more difficult... Without the font tags it would be an easy matter to check that the date is the only thing within the data cell innerHTML... As it is, I have no idea what will happen if some of your links contain numbers which match the date... But if this proves to be a problem... See above...



<script type="text/javascript">
<!--//
onload = function(){
var td = document.getElementsByTagName('TD');
for(var i=0; i<td.length; i++){
if(td[i].innerHTML.match(new Date().getDate(),'g')){
td[i].style.backgroundColor = 'red';
}
}
}
//-->
</script>
</head>


.....Willy

newfoundnoise82
Feb 10th, 2005, 04:49 PM
thank you very much it appears to work well