Solved

Colors in an event page

Posted on 2009-07-15
5
172 Views
Last Modified: 2012-05-07
I am not very familiar with CSS/Cold Fusion code.  Let's just say not at ALL familiar.

I have the piece of code below, and basically, when the column on the far right says "OPEN" I want it to be dark green.  When it says "CLOSED" I want it Black.  When it says REAL WORLD, I want it in RED.

Can someone  help rewrite this line to do what I need?  It could be that it's Black unless it says OPEN or REAL WORLD.

Thank you!
as reads:

  <td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:green">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>
 

This piece of code really works on another page, but I couldn't get it to do what I wanted to do on this newer page:
 

<td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:red">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>
 

Would this piece do what I need:  
 

<td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:green">OPEN<br> #calchours# H, #calcminutes# M<cfif IsReal World is 1>style="color:red">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>

Open in new window

0
Comment
Question by:TIgerV
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
How about this..
<td onclick="rowtoggle(#EventID#);" align="right">

 <cfif isOpen>

   <span style="color:green;">OPEN

 <cfelseif isRealWorld>

   <span style="color:green;">OPEN

 <cfelse>

   <span style="color:grey;">CLOSED

 </cfif> 

  #calchours# H, #calcminutes# M

  </span>

</td>

Open in new window

0
 
LVL 13

Expert Comment

by:Murali Murugesan
Comment Utility
i would suggest you to use modulo logic for this.

Note: I dont know cold fusion, but the below is a logic i use in JSP to make it simple.

<style>
.odd{
   color:green;
}

.even{
color:red;
}

.even_grey{
color:grey;
}
</style>


<td class=" IsOpen eq 1?'odd':IsReal eq 1?'even':'even_grey'"></td>

-Murali*

0
 
LVL 1

Accepted Solution

by:
xamian earned 500 total points
Comment Utility
Assuming your testing against a single value, here's an example of how to do what you want to do....(I think):

<!-- Here I'm using  the variable named "TheStatusValue" to hold the incoming information.  This could be coming from a query or another source, it doesn't really matter  -->
<cfset TheStatusValue = "Real World">

<td onclick="rowtoggle(#EventID#);" align="right"
      <cfif TheStatusValue is "Open">
          style="color:green"
    <cfelseif TheStatusValue is "Real World">
          style="color:red"
    <cfelseif TheStatusValue is "Closed">
          style="color:black"    
    </cfif>>
</td>
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility


If you're testing only one value, then use cfswitch

 
0
 
LVL 1

Expert Comment

by:xamian
Comment Utility
I'm guessing there's more to it because the variables in his example seem to be boolean values, so maybe he needs to test the combination of values and change the colors accordingly.  A little more detail would help.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 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

11 Experts available now in Live!

Get 1:1 Help Now