Colour coding Text

Results 1 to 2 of 2

Thread: Colour coding Text

  1. #1
    Join Date
    Dec 1969

    Default Colour coding Text

    I pull order values from a SQL Server database and display using asp. How can I set up a script so that if the value is negative it uses a red font, but if the value is positive, it displays using the default font?

  2. #2
    Join Date
    Dec 1969

    Default RE: Colour coding Text

    Here&#039;s a small piece of script that demonstrates how to do this:<BR><BR>arrNumbers = Array(22, -13, -66, 0, 412, -0, -88)<BR><BR>For i = LBound(arrNumbers) To UBound(arrNumbers)<BR> <BR> If arrNumbers(i) &lt; 0 Then<BR> <BR> fontColor = "#ff0000"<BR> <BR> Else<BR> <BR> fontColor = "#0000ff"<BR> <BR> End If<BR> <BR> Response.Write "&lt;span style=""color: &#039;" & fontColor & "&#039;""&#062;" <BR> Response.Write formatCurrency(arrNumbers(i), 2,,True)<BR> Response.Write "&lt;span&#062;&lt;br /&#062;" & vbCrLf<BR> <BR> Next<BR><BR><BR>HTH<BR><BR>Darren<BR>[ ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts