General Chat
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsGeneralGeneral Chat

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 5th, 2004, 04:41 PM
exequor exequor is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 190 exequor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 51 sec
Reputation Power: 2
Alternating the background colour

how do i alternate the background colour for differenct rows in a table. hey CodeKadiya i know that you did it in your forum. How is it done?

Reply With Quote
  #2  
Old June 5th, 2004, 04:53 PM
libadisauce libadisauce is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Washington
Posts: 24 libadisauce User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to libadisauce
RE: Alternating the background colour

Using a for loop you could do this:
php Code:
Original - php Code
  1.  
  2. for($i = 0; $i < $lenght; $i++) {
  3.      if($i%2) {
  4.           echo "<tr bgcolor='blue'><td>{$info}</td></tr>";
  5. } else {
  6.       echo "<tr bgcolor='white'><td>{$info}</td></tr>";
  7. }
  8. }


You could do something similar with a while loop:
php Code:
Original - php Code
  1.  
  2. $i = 0;
  3. while($sucess == true) {
  4.      if($i%2) {
  5.           echo "<tr bgcolor='blue'><td>{$info}</td></tr>";
  6. } else {
  7.       echo "<tr bgcolor='white'><td>{$info}</td></tr>";
  8. }
  9.     $i++;
  10. }

Reply With Quote
  #3  
Old June 6th, 2004, 08:55 AM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'Programming Theory' to 'General Chat' by zombie.

Reason:

Reply With Quote
  #4  
Old June 6th, 2004, 10:31 AM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: Alternating the background colour

http://codewalkers.com/tutorials/6/1.html

Reply With Quote
Reply

Viewing: Codewalkers ForumsGeneralGeneral Chat > Alternating the background colour


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway