Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting properties of Response.Write objRS()

Status
Not open for further replies.

mikemedia

Programmer
Apr 28, 2006
39
US
I've done this in javaScript:
Change text color based on value e.g.,

if (parseFloat(document.getElementById(f_delta_1st).value) > 0){
document.getElementById(f_delta_1st).style.color="green";
}

========

Now my ASP is reading these "number" datatypes and I would like to color them red or green based on +/- value.

<% Response.Write objRS("f_delta_1st") %>
 
did you mean:
Code:
<% 
if cInt(objRS("f_delta_1st")) > 0 then
Response.write "<font color=green>" & objRS("f_delta_1st")  & "</font>"

else
Response.write "<font color=red>" & objRS("f_delta_1st")  & "</font>"

end if
 %>

-DNG
 
Wow! I just posted this on another forum:
Yours seems simpler , and correct me if I'm wrong, I can place it before <body> Right?
--------------
Newbie asks: Is this correct and if so, where in the (existing) html <body>: does it go? I men no matter where I place the snippet, it's gonna be within a tag.

If objRS("gross_err") > 0 Then
Response.Write "<tr><td><font color=""green"">" & “+” objRS("gross_err ") & "</font></td>"
Else
Response.Write "<tr><td><font color=""red"">" & “-” objRS("gross_err ") & "</font></td>"
End If
 
Cut and pasted your exact code just above the body tag without result. Should I paste it somewhere else?
 
your code on the page should look like the following...
Code:
<html>
<head>
</head>
<body>

YOUR ASP CODE HERE

</body>

</html>

-DNG
 
The logic seems to be exactly what I'm looking for:

If the integer value of the object "f_delta_1st" is greater than 0, then make the font color of the object "f_delta_1st" green.

I'e pasted it immediately following the body tag <body>

So, what have I overlooked?

I appreciate your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top