View Full Version : Conditional Formatting
RaRdEvA
January 27th, 2006, 03:05 PM
Hi everyone, i have been looking for this in several places and still no luck. What i want is the ASP document to display different colors depending on the value loaded from the database.
I have a table in wich i ask the database for a value wich is the number of posts that that person has. Now i want that number to be displayed in a different color depending on the value:
1-5 = Blue
6-10 = yellow
11-15 = orange
16+ = Red
To be honest i am not programmer or developer, i guide myself with tutorials that i find on the web, the only tuts i have found are related to Grids.
I hope somebody can help me with this, seriously, i have been 2 days trying to find how to do it.
Thanks in Advance
:ogre: <- Is Cool :D
RaRdEvA
January 28th, 2006, 09:25 AM
no replies v.v
RaRdEvA
January 30th, 2006, 10:08 AM
pumping up
antizip
January 30th, 2006, 10:51 AM
i'm familiar with asp what do you have so far?
mpelland
January 30th, 2006, 11:06 AM
not really familiar with ASP but what about
<style>
.postColor {
color=
<%
Dim textColor
textColor = userPosts / 5
Select Case textColor
Case 0
Response.Write("blue")
Case 1
Response.Write("blue")
Case 2
Response.Write("yellow")
Case 3
Response.Write("orange")
Case > 3
Response.Write("red")
End Select
%>
}
</style>
<span class='postColor'>#user post here</span>
RaRdEvA
January 30th, 2006, 11:11 AM
the best i found is this, at codecharge.com
Function Tasks_Priority_BeforeShow(Sender)
If Tasks.Priority.Value = "High" Then
Tasks.Priority.Value = "<font color=RED>"&Tasks.Priority.Value&"</font>"
Elseif Tasks.Priority.Value = "Low" Then
Tasks.Priority.Value = "<font color=GREEN>"&Tasks.Priority.Value&"</font>"
End if
End Function
What i found everywhere is taht i need to set a function on the server side before the data is rendered, (but i am not programmer) so its difficult for me,
heres the page:
http://docs.codecharge.com/studio3/html/index.html?http://docs.codecharge.com/studio3/html/ProgrammingTechniques/HowTo/ModifyingHTMLOutput/ChangeTextColor.html
my big problem is (i barely understand xD)
RaRdEvA
January 30th, 2006, 11:15 AM
not really familiar with ASP but what about
<style>
.postColor {
color=
<%
Dim textColor
textColor = userPosts / 5
Select Case textColor
Case 0
Response.Write("blue")
Case 1
Response.Write("blue")
Case 2
Response.Write("yellow")
Case 3
Response.Write("orange")
Case > 3
Response.Write("red")
End Select
%>
}
</script>
<span class='postColor'>#user post here</span>
when i added the code everything on the page was gone x.x
RaRdEvA
January 30th, 2006, 11:16 AM
By the way thanks a lot for your reply :D i've been waiting for some days now
mpelland
January 30th, 2006, 11:20 AM
well i mean, like i said.. i am not very fluent with asp. that is based on VB code .. secondly there was an error that may cause trouble that is fixed now
the first part (in the style tags) is meant for the head section of the page. it is a css definition for the text. the userPosts variable is not set there.. but would have to be set somewhere in your page.. i guess that is what you are using Tasks.Priority.Value for.
RaRdEvA
January 30th, 2006, 11:22 AM
ok, i found out why the page went blank, it was because i didnt add the style propperly (shame) when i fixed it the browser displayed error in the line:
Case > 3
i removed that line and all of the results were in blue (as stated in first line of code)
RaRdEvA
January 30th, 2006, 11:24 AM
yes it is, inside a table like you said before:
<td width="55" height="25" align="center" bgcolor="#000000"><span class="postColor"><%=(rsMessageCount.Fields.Item("postCount").Value)%>
i should be adding after class like this class="postColor" but not working =/
Seb Hughes
January 30th, 2006, 12:16 PM
cant you just use simple if staments?
Ben Smith
January 30th, 2006, 12:24 PM
You could, but that would be slightly pointless and take unnecessary typing.
Switch statements are a lot easier
RaRdEvA
January 30th, 2006, 12:27 PM
thats what im trying to do, look:
Function colorChange(Sender)
If rsCounts.CountOfID.Value > 3 Then
rsCounts.CountOfID.Value = "<font color=RED>"&rsCounts.CountOfID.Value&"</font>"
Elseif rsCounts.CountOfID.Value < 3 Then
rsCounts.CountOfID.Value = "<font color=GREEN>"&rsCounts.CountOfID&"</font>"
End if
End Function
RaRdEvA
January 30th, 2006, 12:31 PM
You could, but that would be slightly pointless and take unnecessary typing.
Switch statements are a lot easier
and how do i do that?? 0.0 (yeah, im newb :*( )
Aggrix
January 30th, 2006, 01:51 PM
I never done anything in ASP but maybe this will work:
IF value < 6 THEN
Response.Write "blue"
ELSEIF value < 11
Response.Write "yellow"
ELSEIF value < 16
Response.Write "orange"
ELSE
Response.Write "red"
RaRdEvA
January 31st, 2006, 10:23 AM
didn-t work :*(
antizip
January 31st, 2006, 10:35 AM
are you just copying and pasting the code into yours? Because all these solutions should work assuming you're taking your variable and swapping it out in the code
If you post your ASP code it will make it lots easier.
RaRdEvA
January 31st, 2006, 07:19 PM
are you just copying and pasting the code into yours? Because all these solutions should work assuming you're taking your variable and swapping it out in the code
If you post your ASP code it will make it lots easier.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
Session.Contents.Remove("MM_Username")
Session.Contents.Remove("MM_UserAuthorization")
MM_logoutRedirectPage = "login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<!--#include file="Connections/conFlags.asp" -->
<!--#include file="Connections/con_log.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="goaway.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_conFlags_STRING
MM_editTable = "forum1"
MM_editRedirectUrl = "thankyou.asp"
MM_fieldsStr = "responder|value|email|value|flagcolor|value|messag e|value|parentID|value"
MM_columnsStr = "responder|',none,''|email|',none,''|flagcolor|',no ne,''|message|',none,''|parentID|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim rsReply1__MMColParam
rsReply1__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
rsReply1__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsReply1
Dim rsReply1_numRows
Set rsReply1 = Server.CreateObject("ADODB.Recordset")
rsReply1.ActiveConnection = MM_conFlags_STRING
rsReply1.Source = "SELECT * FROM forum1 WHERE ID = " + Replace(rsReply1__MMColParam, "'", "''") + ""
rsReply1.CursorType = 0
rsReply1.CursorLocation = 2
rsReply1.LockType = 1
rsReply1.Open()
rsReply1_numRows = 0
%>
<%
Dim rsCounts__MMColParam
rsCounts__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
rsCounts__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsCounts
Dim rsCounts_numRows
Set rsCounts = Server.CreateObject("ADODB.Recordset")
rsCounts.ActiveConnection = MM_conFlags_STRING
rsCounts.Source = "SELECT * FROM forum2 WHERE ID = " + Replace(rsCounts__MMColParam, "'", "''") + ""
rsCounts.CursorType = 0
rsCounts.CursorLocation = 2
rsCounts.LockType = 1
rsCounts.Open()
rsCounts_numRows = 0
%>
<%
Dim rsReply2__MMColParam
rsReply2__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
rsReply2__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsReply2
Dim rsReply2_numRows
Set rsReply2 = Server.CreateObject("ADODB.Recordset")
rsReply2.ActiveConnection = MM_conFlags_STRING
rsReply2.Source = "SELECT * FROM forum1 WHERE parentID = " + Replace(rsReply2__MMColParam, "'", "''") + " ORDER BY datestamp DESC"
rsReply2.CursorType = 0
rsReply2.CursorLocation = 2
rsReply2.LockType = 1
rsReply2.Open()
rsReply2_numRows = 0
%>
<%
Dim rsDetails__MMColParam
rsDetails__MMColParam = "1"
If (Session("MM_Username") <> "") Then
rsDetails__MMColParam = Session("MM_Username")
End If
%>
<%
Dim rsDetails
Dim rsDetails_numRows
Set rsDetails = Server.CreateObject("ADODB.Recordset")
rsDetails.ActiveConnection = MM_con_log_STRING
rsDetails.Source = "SELECT * FROM uid WHERE username = '" + Replace(rsDetails__MMColParam, "'", "''") + "'"
rsDetails.CursorType = 0
rsDetails.CursorLocation = 2
rsDetails.LockType = 1
rsDetails.Open()
rsDetails_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsReply2_numRows = rsReply2_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
</SCRIPT>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Telvista Centro Histórico ::: Flag Report System </title>
<style type="text/css">
<!--
.style15 {color: #333333;
font-weight: bold;
}
.style17 {color: #6699CC;
font-weight: bold;
font-size: xx-small;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style22 {font-size: large;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #6699FF;
}
.style23 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style24 {color: #6699CC; font-weight: bold; font-size: small; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style25 {font-size: small; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style4 {color: #6699CC;
font-weight: bold;
}
.style6 {font-size: small;
font-weight: bold;
}
.style9 {color: #6699CC; font-weight: bold; font-size: small; }
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #6699FF;
}
a:link {
color: #6699FF;
}
a:hover {
color: #6666CC;
}
.style28 {font-size: medium; font-weight: bold; color: #333333; }
.style29 {color: #6699CC; font-weight: bold; font-size: x-small; font-family: Verdana, Arial, Helvetica, sans-serif; }
a:visited {
color: #6699CC;
}
.style31 {font-size: small; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333; }
.style32 {color: #000000}
.style33 {color: #666666}
.style34 {
color: #f7f7f7;
font-size: x-small;
}
.style35 {
color: #000000;
font-weight: bold;
font-size: small;
}
.style37 {color: #CCCCCC}
.style39 {font-size: medium; font-weight: bold; color: #6699FF; }
.style40 {font-size: medium; font-weight: bold; color: #006699; }
.style42 {font-size: large; font-family: Arial; color: #FFFFFF; }
-->
</style>
</head>
<body>
<p> </p>
<table width="825" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="825"><p><img src="tvlogo.gif" alt=" " width="150" height="65" /></p>
<p> </p></td>
</tr>
</table>
<table width="825" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td height="40" colspan="7" bgcolor="#CCCCCC"><table width="796" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="292" align="center"><span class="style22">FLAG Registry Service</span></td>
<td width="504" align="right" class="style6"><a href="<%= MM_Logout %>" onClick="javascript:self.close();">LOG OFF</a> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="7" bgcolor="#E2E2E2"><table width="821" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="112" height="24" align="right" bgcolor="#F3F7F8" class="style23"><span class="style6"><a href="messages.asp">Back to Main </a></span></td>
<td width="539" align="left" bgcolor="#F3F7F8" class="style23"> </td>
<td width="162" align="center" bgcolor="#F3F7F8" class="style24"><a href="#post">Add a New Flag</a> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="106" align="center" bgcolor="#E2E2E2"><span class="style25">Employee #:</span></td>
<td colspan="2" bgcolor="#E2E2E2" class="style4"><p class="style23"><span class="style6">Employee Name:</span></p></td>
<td align="center" bgcolor="#E2E2E2" class="style4"> </td>
<td align="center" bgcolor="#E2E2E2" class="style4"><span class="style6">Campaign:</span></td>
<td width="57" align="center" bgcolor="#E2E2E2"><span class="style17">Number Of Flags:</span></td>
<td width="101" align="center" bgcolor="#E2E2E2"><p class="style24">Origin Date:</p></td>
</tr>
<tr>
<td height="23" colspan="7" bgcolor="#F4F4F4"><table width="805" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="104" align="center" valign="middle"><span class="style28"><%=(rsReply1.Fields.Item("author").Value)%></span></td>
<td width="260" valign="middle"><p align="justify" class="style28"><%=(rsReply1.Fields.Item("subject").Value)%></p></td>
<td width="130" align="center" valign="middle" class="style39"> </td>
<td width="130" align="center" valign="middle" class="style40"><%=(rsReply1.Fields.Item("campaign").Value)%></td>
<td width="55" height="25" align="center" bgcolor="#000000"><span class="style42"><%=(rsCounts.Fields.Item("CountOfID").Value)%></span></td>
<td width="100" align="center" class="style24"><%= DoDateTime((rsReply1.Fields.Item("datestamp").Value), 2, -1) %></td>
</tr>
</table></td>
</tr>
<tr>
<td height="34" colspan="7" align="center" bgcolor="#e8e8e8" class="style9">FLAGS TO DATE </td>
</tr>
<tr>
<td colspan="2" align="center" valign="top" bgcolor="#E2E2E2" class="style9">Reporter: </td>
<td width="272" valign="top" bgcolor="#E2E2E2" class="style9">Description of Reported Flag:</td>
<td width="136" valign="top" bgcolor="#E2E2E2" class="style9"> </td>
<td width="136" valign="top" bgcolor="#E2E2E2" class="style9"> </td>
<td width="57" align="center" valign="top" bgcolor="#E2E2E2" class="style9"><span class="style4">Flag ID: </span></td>
<td width="101" align="center" valign="top" bgcolor="#E2E2E2" class="style9"><p class="style4">Origin Date:</p></td>
</tr>
<tr>
<td height="153" colspan="7" align="center" bgcolor="#FFFFFF"><%
While ((Repeat1__numRows <> 0) AND (NOT rsReply2.EOF))
%>
<table width="821" cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="103" rowspan="2" align="center" valign="top" bgcolor="#F3F7F8"><p class="style24"><a href="mailto:<%=(rsReply2.Fields.Item("email").Value)%>" class="style32"></a><a href="mailto:<%=(rsReply2.Fields.Item("email").Value)%>" class="style32"><%=(rsReply2.Fields.Item("responder").Value)%></a></p></td>
<td width="541" align="left" valign="middle" bgcolor="#666666"><p class="style31 style33"><span class="style37">FLAG TYPE:</span> <%=(rsReply2.Fields.Item("flagcolor").Value)%><br /></td>
<td width="53" rowspan="2" align="center" bgcolor="#F5F5F5" class="style9"><%=(rsReply2.Fields.Item("ID").Value)%></td>
<td width="95" rowspan="2" align="center" bgcolor="#F5F5F5" class="style29"><%=(rsReply2.Fields.Item("datestamp").Value)%></td>
</tr>
<tr>
<td align="left" valign="middle" bgcolor="#F3F7F8"><table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" align="left" valign="top"> </td>
<td width="440" valign="middle"><p><%=(rsReply2.Fields.Item("message").Value)%></p>
<p> </p></td>
</tr>
</table>
</td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsReply2.MoveNext()
Wend
%>
<span class="style6">
<% If rsReply2.EOF And rsReply2.BOF Then %>
There Are No Flags Yet.<br />
<a href="#post">Add A Flag</a>
<% End If ' end rsReply2.EOF And rsReply2.BOF %>
</span> </td>
</tr>
<tr>
<td height="35" colspan="7" align="center" bgcolor="#e8e8e8"><span class="style6">Telvista Flag Registry </span></td>
</tr>
</table>
<p><a name="post" id="post"></a></p>
<form ACTION="<%=MM_editAction%>" METHOD="POST" id="form1" name="form1">
<table width="600" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td height="30" colspan="2" align="left" valign="middle" bgcolor="#CCCCCC"><blockquote>
<p><strong class="style9">Add a Flag To: </strong></p>
<p class="style15"><%=(rsReply1.Fields.Item("subject").Value)%> </p>
</blockquote></td>
</tr>
<tr>
<td height="37" align="right" bgcolor="#F7F7F7" class="style9">Your Name:</td>
<td bgcolor="#F7F7F7"><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="style32"><strong><%=(rsDetails.Fields.Item("firstname").Value)%></strong><span class="style34">&</span><strong><%=(rsDetails.Fields.Item("lastname").Value)%></strong></td>
</tr>
</table>
<input name="responder" type="hidden" id="responder" value="<%=(rsDetails.Fields.Item("firstname").Value)&" "&(rsDetails.Fields.Item("lastname").Value)%>" /></td>
</tr>
<tr>
<td height="37" align="right" bgcolor="#F7F7F7" class="style9">Your E-Mail Address:</td>
<td bgcolor="#F7F7F7"><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="120" class="style35"><%=(rsDetails.Fields.Item("email").Value)%></td>
<td width="280" class="style32"> </td>
</tr>
</table>
<input name="email" type="hidden" id="email" value="<%=(rsDetails.Fields.Item("email").Value)%>" /></td>
</tr>
<tr>
<td height="24" align="right" bgcolor="#F7F7F7" class="style9">Flag Type: </td>
<td bgcolor="#F7F7F7"><label></label>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="120" class="style35"><select name="flagcolor" size="1" id="flagcolor">
<option>SELECT FLAG COLOR</option>
<option value="<font color=#33CC33>GREEN</font>">GREEN FLAG</option>
<option value="<font color=#CECE00>YELLOW</font>">YELLOW FLAG</option>
<option value="<font color=#FF6600>ORANGE</font>">ORANGE FLAG</option>
<option value="<font color=#FF0000>RED</font>">RED FLAG</option>
</select></td>
<td width="280" class="style32"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="161" height="95" align="right" bgcolor="#F7F7F7" class="style9">Description of Report:</td>
<td width="432" bgcolor="#F7F7F7"><label></label>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="style35"><textarea name="message" cols="40" rows="5" class="style15" id="message"></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#F7F7F7" class="style9"> </td>
<td bgcolor="#F7F7F7"><input name="parentID" type="hidden" id="parentID" value="<%= Request.QueryString("ID") %>" /></td>
</tr>
<tr>
<td height="44" colspan="2" valign="middle" bgcolor="#E8E8E8"><blockquote>
<p>
<label>
<div align="center">
<br />
<input type="submit" name="Submit" value="Submit" />
</label>
</blockquote></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p></p>
</body>
</html>
<%
rsReply1.Close()
Set rsReply1 = Nothing
%>
<%
rsCounts.Close()
Set rsCounts = Nothing
%>
<%
rsReply2.Close()
Set rsReply2 = Nothing
%>
<%
rsDetails.Close()
Set rsDetails = Nothing
%>
Thanks for the reply :D
RaRdEvA
January 31st, 2006, 07:36 PM
This is the most recent try:
<%
Dim textColor
Function fUseStyle(vNumber)
If vNumber>0 And vNumber<8 Then textColor="#66CC66"
If vNumber>7 And vNumber<15 Then textColor="#FFFF00"
If vNumber>14 And vNumber<22 Then textColor="#FF6600"
If vNumber>21 And vNumber<29 Then textColor="#990000"
End Function
%>
.colorChange {font-size: large; font-family: Arial; color: 'textColor'; }
<td width="55" height="25" align="center" bgcolor="#000000"><span class="colorChange"><%=(rsCounts.Fields.Item("CountOfID").Value)%></span></td>
The fonts are taking the default style of the page =/
RaRdEvA
January 31st, 2006, 08:41 PM
OMG im making just misstakes here X.X i need a cofee break :wasted:
mpelland
February 1st, 2006, 08:58 AM
hey,
your most recent try isn't too far off from working.
you should try
.colorChange {font-size: large; font-family: Arial; color: '<%=(textColor)%>'; }
i don't know much about ASP .. but if it is anything like php or jsp, the variables don't carry over to the styles, you have to print it out from asp
Ben Smith
February 1st, 2006, 12:44 PM
I don't think dynamic CSS is the solution...cos it'll change everything.
I think you want this
<%
switch(vNumber){
case 0,1,2,3,4,5,6,7,8:
textColor = "something";
break;
case default:
textColor = "somethingelse";
break;
}
%>
I'm a PHP guy myself but I think that should work.
mpelland
February 1st, 2006, 12:58 PM
well i guess it all depends on your use for the style. is there going to be more than one thing that changes colour? if not then you don't really need the style .. but if you are going to be using the same effect on different areas of the site then you should create the style
RaRdEvA
February 1st, 2006, 04:28 PM
Thank you very much for you attention guys, at the moment i lost my files so i have to make the forum again :*(
When i get into the point that i need that i will post again if it worked.
and Omega, what do you think is better to develop, PHP or ASP?
Thanks again Guys
RaRdEvA
February 21st, 2006, 01:54 PM
Solved :D
<% If Not rsListadogeneral.EOF Or Not rsListadogeneral.BOF Then %>
<%
Function fColorBg(vNumber)
Select Case vNumber
Case 1
fColorBg="#FCF501"
;)
Thanks to everyone for the attention and Help :X
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.