Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Przemienne kolory rekordów w tabeli
eurosoft
post
Post #1





Grupa: Zarejestrowani
Postów: 179
Pomógł: 0
Dołączył: 5.11.2010

Ostrzeżenie: (0%)
-----


w jaki sposób można zrobić przemienne kolorowanie kolejnych rekordów w tabeli?
Poniżej fragment kodu generującego tabelę:

  1. ...
  2. echo "<th>Ilość</th>";
  3. echo "<th>Osoba wpisująca</th>";
  4. echo "<th>Info</th>";
  5.  
  6. while($r = mysql_fetch_array($result) and $z = mysql_fetch_array($result1))
  7.  
  8. {
  9. echo "<tr>";
  10. echo "<td width=40 align=center>".$r[0]."</td>";
  11. echo "<td width=140>".$r[1]."</td>";
  12. echo "<td width=50 align=center>".$r[2]."</td>";
  13. echo "<td width=60 align=center>".$r[3]."</td>";
  14.  
  15. ....


Ten post edytował eurosoft 9.11.2010, 09:01:16
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
andrzej_
post
Post #2





Grupa: Zarejestrowani
Postów: 60
Pomógł: 1
Dołączył: 11.06.2010

Ostrzeżenie: (0%)
-----


Poszedłbym za radą phpion.

  1.  
  2. <style type="text/css">
  3. .tab tr:nth-child(odd) {
  4. border: 0px;
  5. background-color:#e2e1e1;
  6. }
  7.  
  8. .tab tr:nth-child(even) {
  9. border: 0px;
  10. background-color:#f6f6f6; }





  1.  
  2. <table class='tab'>
  3.  
  4. ...
  5. echo "<th>Ilość</th>";
  6. echo "<th>Osoba wpisująca</th>";
  7. echo "<th>Info</th>";
  8.  
  9. while($r = mysql_fetch_array($result) and $z = mysql_fetch_array($result1))
  10.  
  11. {
  12. echo "<tr>";
  13. echo "<td width=40 align=center>".$r[0]."</td>";
  14. echo "<td width=140>".$r[1]."</td>";
  15. echo "<td width=50 align=center>".$r[2]."</td>";
  16. echo "<td width=60 align=center>".$r[3]."</td>";
  17.  
  18. ....


Ten post edytował andrzej_ 9.11.2010, 16:06:52
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 17:19