PDA

View Full Version : rotating table bg-color



jonsey
02-12-2007, 07:00 PM
Is there a way for css to handle table background for each row. If 0 then xzy_color and if 1 the abc_color.

r0 = row 0 and r1 = row 1

CSS code




.r0
{
height: 50px;
background-color: #EBECD1;
font-family: Verdana, sans-serif;
font-size: 10pt;
}

.r1
{
height: 50px;
background-color: white;
font-family: Verdana, sans-serif;
font-size: 10pt;
}



Here is my ASP if this help in how I'm genurating the tables.



<%
Option Explicit
Response.Buffer = True

Dim oXml, oGroup, oQuestion, lGroup, lQuestion

Set oXml = Server.CreateObject("Microsoft.XMLDOM")
oXml.async = False
oXml.load (Server.MapPath("paafv2.xml"))
%>

<html>
<head><title></title></head>
<body>
<table>
<form action="Questionnaire.asp?action=submit" method="post">
<%
If Request.QueryString("action") = "submit" Then
For lGroup = 0 to oXml.SelectNodes("//root/group").Length - 1
Set oGroup = oXml.SelectNodes("//root/group").Item(lGroup)

Response.Write("<tr><td><b>" & oGroup.SelectSingleNode("@name").Text & "</b></td></tr>")

For lQuestion = 0 to oGroup.SelectNodes("question").Length - 1
Set oQuestion = oGroup.SelectNodes("question").Item(lQuestion)

Response.Write("<tr><td>" & oQuestion.SelectSingleNode("text").Text & " Answer: " & Request.Form("question_" & lGroup & "_" & lQuestion) & "</tr></td>")
Next

Response.Write("<tr><td><br><br></td></tr>")
Next
Else
For lGroup = 0 to oXml.SelectNodes("//root/group").Length - 1
Set oGroup = oXml.SelectNodes("//root/group").Item(lGroup)

Response.Write("<tr><td><b>" & oGroup.SelectSingleNode("@name").Text & "</b></td></tr>")

For lQuestion = 0 to oGroup.SelectNodes("question").Length - 1
Set oQuestion = oGroup.SelectNodes("question").Item(lQuestion)

Response.Write("<tr><td>" & oQuestion.SelectSingleNode("text").Text)

If oQuestion.SelectSingleNode("@response").Text = "2" Then
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""100"">Yes")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""0"" checked>No")
ElseIf oQuestion.SelectSingleNode("@response").Text = "3" Then
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""100"">Yes")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""0"" checked>No")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""50"">Maybe")
ElseIf oQuestion.SelectSingleNode("@response").Text = "5" Then
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""0"" checked>1")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""25"" checked>2")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""50"" checked>3")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""75"" checked>4")
Response.Write("&nbsp;<input type=""radio"" name=""question_" & lGroup & "_" & lQuestion & """ value=""100"" checked>5")
End If
Response.Write("<br><font size=""1"">" & oQuestion.SelectSingleNode("desc").Text & "</font></td></tr>")
Next

Response.Write("<tr><td><br><br></td></tr>")
Next

Response.Write("<tr><td><input type=""submit"" value=""Submit Selections""></tr></td>")
End If
%>
</form>
</table>

</body>
</html>

<%
Set oXml = Nothing
Set oGroup = Nothing
Set oQuestion = Nothing
%>




Cheers,
Jonsey