Solved

Text Color

Posted on 2003-11-29
5
241 Views
Last Modified: 2013-12-24
Dear Experts,

I have a dynamic field that will be either High, Medium or low. Need to know how to change the text color based on the value. High=Red, Medium=Black, Low=Yellow.

Best regards,
AJ
0
Comment
Question by:aj10101
5 Comments
 
LVL 17

Accepted Solution

by:
anandkp earned 200 total points
ID: 9844518
Hi,

<cfset dynamic_field_value = "High"> <!--- this variable is set dynamically based on ur code ... i am assuming the value to be set as high for this example --->

<font face="verdana" size="2" color="<cfif comparenocase(dynamic_field_value,'high') eq 0>red<cfelseif comparenocase(dynamic_field_value,'medium') eq 0>black<cfelse>yellow</cfif>">
anandkp
</font>

hth

let me know

K'Rgds
Anand

PS : u can also use CFSWITCH CASE - if ur comfortable using it.
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 9846861
I was thinking more like something simpler like

<cfparam name="priority" default="medium"> <!--- you can leave this out if you don't need a default --->

<style type="text/css">
<!--
.high {
      color: #FF0000;
}
.medium {
      color: #000000;
}
.low {
      color: yellow;
}
-->
</style>


<span class="#priority#">Your text</span>
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9847049
You can also have it this way :

<cfparam name="txtcolor" default="red">
<cfparam name="dynamicfld default"High">

<cfswitch expression="#dynamicfld#">
  <cfcase value="Medium">
    <cfset txtcolor="black">
  </cfcase>
  <cfcase value="Low">
    <cfset txtcolor="yellow">
  </cfcase>
  <cfdefaultcase>
  </cfdefaultcase>
</cfswitch>

<cfoutput>
  <input type="text" name="textfield" value="#dynamicfld#" style="font color:#txtcolor#;">
</cfoutput>

The value of the textfield will depend on the value being set to the parameter "dynamicfld".

Goodluck!
eNTRANCE2002 :-)
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9881724
hello ???
0
 

Author Comment

by:aj10101
ID: 9883254
anandkp,

thanks for the help.
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Join & Write a Comment

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now