Solved

Text Color

Posted on 2003-11-29
5
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IIS 8.5 2 52
IIS Site Configuration Copy 2 82
Need to redirect request from IIS server to old Apache Server. 3 157
Systems talking to each other 5 147
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
What You Need to Know when Searching for a Webhost Provider
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 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