Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Text Color

Posted on 2003-11-29
5
Medium Priority
?
288 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 800 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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