You could even write a quick udf to do this and make it even more
readable:
<cfscript>
Function altRow(row) {
if (row mod 2 eq 1) {
return '.high';
}
else {
return '.low';
}
}
</cfscript>
Then just do:
<td class="#altRow(get_events.currentrow)#">
#dateformat(get_events.event_date, "ddd")#
</td>
Chris Peterson
Gainey IT
Adobe Certified Advanced Coldfusion Developer
-----Original Message-----
From: gary gilbert [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 27, 2007 8:18 AM
To: CF-Talk
Subject: Re: Why wouldn't the first cell alternate colors with this
code?
Hi Rick,
If I may make a suggestion, put your style info into two classes and
then
this:
<cfif get_events.currentrow mod 2>
<td style="padding-top: 1px; padding-bottom: 2px; width: 35px;
border-left:
1px solid ##aaa; border-bottom: 1px solid ##aaa; background: ##ccc;
color:
black; font-size: 11px; font-weight: normal; text-align:
center;">#dateformat(get_events.event_date, "ddd")#</td> <cfelse>
<td style="padding-top: 1px; padding-bottom: 2px; width:
35px; border-left: 1px solid ##aaa; border-bottom: 1px solid ##aaa;
background: ##eee; color: black; font-size: 11px; font-weight: normal;
text-align: center;">#dateformat(get_events.event_date, "ddd")#</td>
</cfif>
Will become:
<style>
...High{
padding-top: 1px;
padding-bottom: 2px;
width:35px;
border-left: 1px solid #aaa;
border-bottom: 1px solid #aaa;
background: #eee;
color: black;
font-size: 11px;
font-weight: normal;
text-align: center;
}
...Low {
padding-top: 1px;
padding-bottom: 2px;
width: 35px;
border-left:1px solid #aaa;
border-bottom: 1px solid #aaa;
background: #ccc;
color:black;
font-size: 11px;
font-weight: normal;
text-align:center;
}
</style>
........
<td class="<cfif get_events.currentrow mod 2>.High<cfelse>.Low</cfif>">
#dateformat(get_events.event_date, "ddd")# </td>
.........
Makes your code a bit more readable and weight a bit less.
Regards,
--
Gary Gilbert
http://www.garyrgilbert.com/blog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289615
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4