Jason didn't say WHY he cared about even or odd, but if you want to use it
to make every other row a different color, a great "trick" is to include
the digits "0" and "1" in style class names and then use the MOD value to
pick which style without ever having to use <CFIF>

You just define style classes like:
  <style>
   .row0 { background: blue }
   .row1 { background: yellow }
  </style>

Then as you loop through the rows watch the count (I'll call it rowCount)
and use it to directly assign the style class

<cfoutput>
<tr style="row#evaluate("rowCount mod 2")#">
</cfoutput>

That will automatically add a 0 or 1 to the end of the class name and your
rows will be alternately colored in an efficient way.



> <cfset thisnum =1>
> <cfloop>
> <cfif thisnum is 2>do this</cfif>
> Blah Blah
> <cfset this num = #thisnum# + 1>
> </cfllop>
> ----- Original Message -----
> From: Jason Larson <[EMAIL PROTECTED]>
> To: CF-Talk <[EMAIL PROTECTED]>
> Sent: Monday, November 20, 2000 8:57 AM
> Subject: Finding an Odd Number
> 
> 
> >
> > Can someone help me out?
> >
> > I have a cfloop that loops 6 times, I want to be able to be able to
output
> > what loop number the current loop is on, and tell if the number is even
or
> > odd.
> >
> > Any help would be greatly appreciated
> >
> > Thanks
> > Jason Larson
> > [EMAIL PROTECTED]
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Structure your ColdFusion code with Fusebox. Get the official book at
> http://www.fusionauthority.com/bkinfo.cfm
> >
> > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> >
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
> 
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to