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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Txt colour in a Dynamic Table 1

Status
Not open for further replies.

Sitehelp

Technical User
Feb 4, 2004
142
GB
If u use dynamic tables in Dreamwaever is there a way to say, IF a field in a row is called "unassigned" then change the text colour to red????????
 
Just add the code in manualy

Code:
<%if recordset1.fields.item("fld").value = "unassigned" then%>
<tr bgcolor=red>
<%else%>
<tr>
<%end if%>

Cheech

[Peace][Pipe]
 
Cheers, is it written out like this, sorry new to all this:

<?php if ViewAmberCalls.fields.item("fld").value = "unassigned" then%>
<tr bgcolor=red>
else
<tr>
end i
?>

Dynamic table is called ViewAmberCalls

Thanks!
 
Not up on php but looks about right to me.

Cheech

[Peace][Pipe]
 
Cheech,
Does the code you have posted above change the font color or the background color. I am trying to change the font color based on the value in a field and this is what i have only it does not work

Code:
<%if RSFeeds.fields.item("Status").value = "OverLoad" then%>
<tr font color="#FF0000">
<%else%>
<tr>
<%end if%>

Can you see what is wrong


Regards

Paul
 
i know basics of php and that is incorrect --


How are you passing your variable GET or POST? Im assuming GET for this example. Or are you just pulling from a Recordset?

Code:
<?
if ($_GET["Status"]=="OverLoad")
print "<tr font color=\"#FF0000\">"
else
print "<tr>";
?>

notice "\" in the print -- that is because the " needs to be escaped (i think). The php forum would be much better suited for this.

zzzzzz
 
DeeCee,
Sorry to confuse you I am using DW4 and asp pages and I am pulling the data from a recordset. The field called "Status" will show only two text alternatives these will be either "OK" or "OverLoad".

What I want to do is:
If the text shows "OverLoad" then the text will be colored RED otherwise the text should be the default colour

Regards

Paul
 
DeeCee,
If you can help me it would be much appreciated

Regards

Paul
 
smurf01

maybe the missing closing brace from the table row tag and the missing opening brace from the font tag isn't helping.

<tr> <font color="#FF0000">

<tr font color="#FF0000">
<%else%>
<tr>

unless that just a typo of course and really they should be table cells




Chris.

Indifference will be the downfall of mankind, but who cares?
 
Chris,
No your right i did miss the braces, one question where would you put the code ???. in the body ???. Or should it go somewhere else

Regards

Paul
 
you would put the code wherever you want the change to occur

so you would have

<html>
<head>...
<body>...
<table>...
<tr>...
<td>...
</td>
</tr>
I want this code to be exectuted here!

zzzzzz
 
I assume you are looking for something like this,
Code:
<tr>
<%
dim varStatus 
varStatus = RSFeeds.fields.item("Status").value

if  lcase(varStatus) = "overload" then
%>
<td style="color:#FF0000;"><%=varStatus%></td>
<%else%>
<td><%=varStatus%></td>
<%end if%>
</tr>



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Chris,
I am struggling here so I am posting my code I hope you don't mind
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/SMstocks.asp" -->
<%
'Set the server locale
Session.LCID = 2057
%> 
<%
Dim RSFeeds
Dim RSFeeds_numRows

Set RSFeeds = Server.CreateObject("ADODB.Recordset")
RSFeeds.ActiveConnection = MM_SMstocks_STRING
RSFeeds.Source = "SELECT *  FROM QryMCSummary  WHERE MC_Group = '413'"
RSFeeds.CursorType = 0
RSFeeds.CursorLocation = 2
RSFeeds.LockType = 1
RSFeeds.Open()

RSFeeds_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
RSFeeds_numRows = RSFeeds_numRows + Repeat1__numRows
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<table width="36%" height="15" border="0" align="center" cellpadding="2" cellspacing="2" style = "border-bottom: 1px solid blue; border-left: 1px solid blue; border-top: 1px solid blue; border-right: 1px solid blue">
  <tr bgcolor="#0000FF"> 
    <td width="48%" height="7"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><font color="#FFFFFF">MACHINE</font></font></div></td>
    <td width="52%" height="7"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><font color="#FFFFFF">NEXT 
        DATE </font></font></div></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td height="7"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#FF0000"><%=(RSFeeds.Fields.Item("MC_Group").Value)%></font></strong></font></div></td>
    <td height="7"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><strong><%=(RSFeeds.Fields.Item("NextDate").Value)%></strong></font></div></td>
  </tr>
</table>
<table width="70%" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr align="center" valign="middle"> 
      <td bgcolor="#0000FF"> 
        <div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">DUE 
        DATE </font></div></td>
      <td bgcolor="#0000FF">
<div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">DAY</font></div></td>
      <td bgcolor="#0000FF"> 
        <div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">FEEDS</font></div></td>
      <td bgcolor="#0000FF"> 
        <div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">DAILY 
        FEEDS </font></div></td>
      <td bgcolor="#0000FF"> 
        <div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">AVAILABLE 
        FEEDS </font></div></td>
      <td bgcolor="#0000FF"> 
        <div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">STATUS</font></div></td>
  </tr>
  <% 
While ((Repeat1__numRows <> 0) AND (NOT RSFeeds.EOF)) 
%>
  <%If (Repeat1__numRows Mod 2) Then%>
  <tr bgcolor="#66CCFF"> 
    <%Else%>
  <tr valign="middle" bgcolor="#CCCCCC"> 
    <%End If%>
    <td> 
      <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("DueDate").Value)%></font></div></td>
    <td> 
      <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("Day").Value)%></font></div></td>
    <td> 
      <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("NoFeeds").Value)%></font></div></td>
    <td> 
      <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("DailyFeeds").Value)%></font></div></td>
    <td> 
      <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("AvailableFeeds").Value)%></font></div></td>
    <td> 
      <div align="center"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><%=(RSFeeds.Fields.Item("Status").Value)%></font></div></td>
	    <%if RSFeeds.fields.item("Status").value = "OverLoad" then%>
  <tr> <font color="#FF0000"></font></tr>
  <%else%>
  <tr> <font color="#000000"></font></tr>
  <%end if%>
  </tr>
  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  RSFeeds.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
RSFeeds.Close()
Set RSFeeds = Nothing
%>



Regards

Paul
 
auto generated gibberish. You are far better writing code by hand, at least that way you can understand it and can be able to debug it!

Code:
<td><div align="center">

<%if RSFeeds.fields.item("Status").value = "OverLoad" then%>

<font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">
<%=(RSFeeds.Fields.Item("Status").Value)%>
</font>

  <%else%>

<font color="#000000" size="2" face="Arial, Helvetica, sans-serif">
<%=(RSFeeds.Fields.Item("Status").Value)%>
</font>

  <%end if%>
</div></td>



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Chris,
I understand what you say about the auto generated code, however I am not proficient enough yet to be able to hand code.

I do appreciate your help and the code you just sent me has worked great.

Thanks for all your help and patientence

[2thumbsup] :-D [2thumbsup]

Regards

Paul
 
star.gif


> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top