WeCodeThings Library
Library of code bits
Glossary    Contact Us
Need a web designer? visit WeCodeThings.Com for more details
Search  
   
Browse by Category


WeCodeThings Library .: ColdFusion .: Change Font | Text color based on winning number or percentage using cfif ColdFusion



Change Font | Text color based on winning number or percentage using cfif ColdFusion

I just wanted to change the font or text color of the winning percentage based on a number. Be sure to use the double pound signs to escape ColdFusion from atempting to assume it is missing an ending pound sign. The LSNumberFormat at the end makes the number show up as a nice number percent.

  1. <cfif #WinPercent# LTE 40>
  2.        <!--- Font Color Red --->
  3.        <font color="##FF0000">
  4. <cfelseif #WinPercent# GT 41 AND #WinPercent# LTE 55>
  5.         <!--- Font Color Black --->
  6.         <font color="##000000">
  7. <cfelseif #WinPercent# GT 56 AND #WinPercent# LTE 70>
  8.         <!--- Font Color Blue --->
  9.         <font color="##0000FF">
  10. <cfelseif #WinPercent# GT 71>
  11.         <!--- Font Color Green --->
  12. <font color="##009900">
  13. </cfif>
  14. <cfoutput>
  15. <p>#LSNumberFormat(WinPercent, '99.99')# %</p>
  16. </cfoutput>  


How helpful was this article to you?

Related Articles

article SQL Count Number of Times a Word or Number Appears in ONE Field or Column
This Query has become my favorite query to...

(No rating)  6-5-2009    Views: 1304   
article how to change cursor to hand using javascript
The simplest way to change the cursor to a...

(No rating)  4-13-2009    Views: 782   
article Create a nice white border around your text using css
Heres how to put a nice white border around...

  4-9-2009    Views: 1491   

User Comments

Add Comment
No comments have been posted.




.: Powered by Lore .:Code by WeCodeThings Website Design and Development