Ask a Question related to Macromedia ColdFusion, Design and Development.
-
MGrey #1
Negative numbers in red
Simple really - here's hoping!
I have product prices (both - and +) that work well using the code below.
However, I need to have the negative numbers display in red and the positive
ones in blue. Is this possible? I've reviewed all the format tags;
DollarFormat, NumberFormat, etc, but none seem to have the ability to set
colour. I've thought of using cfset but I'm not sure where it should be
specified in the code below:
Thanks for all advice in advance,
Marcus G.
<cfif getoptions.RecordCount gt 0>
<div align="right">
<cfloop query="getoptions">
#NumberFormat(getoptions.price,'+_______,___.__')#
</cfloop>
</div>
</cfif>
MGrey Guest
-
Negative margin
Hello, I just tested a new layout (css and html validated of course), that use negative margin. No editing possible in Contribute. Has the... -
Pulling only negative numbers from a db
I have a field in my db that stores both negative numbers and positive numbers. I want to sum only the negative numbers. Is there a way to do this.... -
negative nelly?
Ben Forta has been publicly stating for years now that CFML skills alone are not enough for ColdFusion developers who want to further their careers... -
negative calculations
Not sure if this is within CF or MySQL, but I have a item with I want to multiply quantity by a negative dollar value. The number and amount are... -
Term:ANSIColor and negative numbers
Hi All using Term:ANSIColor - does anyone know if it's possible ( or maybe I mean practical) to print out negative numbers in say RED, at the... -
prayank #2
Re: Negative numbers in red
hi MGrey
This is a simple coding issue, change the following lines from :
....
<cfloop query="getoptions">
#NumberFormat(getoptions.price,'+_______,___.__')#
</cfloop>
....
to :
<cfloop query="getoptions">
<CFIF #getoptions.price# GTE 0> <font color="blue" >
#NumberFormat(getoptions.price,'+_______,___.__')# </font>
<CFELSE>
<font color="red">#NumberFormat(getoptions.price,'+_____ __,___.__')#</font>
</CFIF>
</cfloop>
This should do it. :)
prayank Guest
-
Rob #3
Re: Negative numbers in red
Instead of <font> you might want to use the more standard (and more
versatile)
<div style="color:red;">
type tag.
Just my 2 cents.
- Rob
Rob Guest
-
MGrey #4
Re: Negative numbers in red
So simple, simple, simple!!!
Thanks prayank! I use this coding all the time but it just didn't hit me I could use it for the currency formatting - thanks again.
MGrey Guest



Reply With Quote

