Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Carcleo

Cor nas linhas

Recommended Posts

Boa tarde a todos.Estou fazendo uma consulta a uma tabela que me retonara um numero de linhas.So que eu gostaria que cada linha saisse de uma cor diferernte.1ª linha preta, 2ª linha azul, 3ª preta, nessa sequencia.Como fazer isso em asp?Cor nas linhas

Compartilhar este post


Link para o post
Compartilhar em outros sites
<%Dim Cor(2)Cor(0) = "cor1"Cor(1) = "cor2"Cor(2) = "cor3"i = 0if i = 0 then    i = 1elseif i = 1 then    i = 2else    i = 0end if%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Só pra tirar a duvida.

Nesse código abaixo, o que tem de errado que num deixa funcionar?

Valeu

<html><head><title>:: FAQ ::</title><link href="sc.css" rel=STYLESHEET type=text/css><meta http-equiv="Pragma" content="no-cache"></head><body topmargin="0" leftmargin="0"><center><!--#include file="../Connections/conexao.asp" --><%If Request.QueryString("action") = 1 Thenchave = request.Form("chave")strSQl = "select * from faq where faq_assunto like '"&chave&"' or faq_memo like '"&chave&"' order by faq_modulo"Set Rs_SELECT = server.createobject("ADODB.Recordset")Rs_SELECT.Open strSQl,conn , 3, 3if not Rs_SELECT.EOF thentotal= Rs_SELECT.recordcountfaq_id = Rs_SELECT("faq_id")	faq_modulo = Rs_SELECT("faq_modulo")	faq_autor = Rs_SELECT("faq_autor")	   response.Write "<br>Procurando por <b>"&chave&"</b>...<br>"   response.Write "Total de ocorrências encontradas: "   response.Write total   response.Write "<br><br>"   response.Write " <table border='0' cellspacing='2'>"   cor_atual = 1Do While not Rs_select.EOF        If  cor_atual = 1 then           response.Write "<tr bgcolor='#F0F0F0'>"        Else           response.Write "<tr bgcolor='#FFFFFF'>"              response.Write "<td width=50  height=20>"&faq_id&"</td>"           response.Write "<td width=70  height=20>"&faq_modulo&"</td>"           response.Write "<td width=320 height=20><a href=verfaq.php?m_id="&faq_id&">"&faq_assunto&"</a></td>"           response.Write "<td width=100 align=center>"&faq_autor&"</td>"            If cor_atual = 1 then              cor_atual = 2           Else              cor_atual = 1           end if  end if      Rs_SELECT.MoveNext loop           response.Write "</table><br><br>"else response.Write "<p><br><p><strong>FAQ Não Encontrada!</strong>"end ifend if%></center></body></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

faz assim

ASP [/tr][tr]

cor_atual = "#F0F0F0"

 

Do While not Rs_select.EOF

If cor_atual = "#F0F0F0" then

cor_atual = "#FFFFFF"

Else

cor_atual = "#F0F0F0"

End If

 

response.Write "<tr bgcolor='' & cor_atual & ">"

response.Write "

<td width=50 height=20>"&faq_id&"</td>"

response.Write "

<td width=70 height=20>"&faq_modulo&"</td>"

response.Write "

<td width=320 height=20><a href=verfaq.php?m_id="&faq_id&">"&faq_assunto&"</a></td>"

response.Write "

<td width=100 align=center>"&faq_autor&"</td>"

 

Rs_SELECT.MoveNext

loop

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.