Hello,
I've been looking for sometime to get a way to diferenciate odd from
even items of a list. The idea would be to diferentialy decorate
alternate rows of a database search result by, for instance, giving
them a diferent background color (white versus light gray, eg). Any
ideas, examples?
Thanks in advance.
Angel 7 6640
Ángel wrote: Hello,
I've been looking for sometime to get a way to diferenciate odd from even items of a list. The idea would be to diferentialy decorate alternate rows of a database search result by, for instance, giving them a diferent background color (white versus light gray, eg). Any ideas, examples?
Thanks in advance. Angel
..odd { background-color: white; }
..even { background-color: #eee; }
not much of a revolution is it.
i would have been nice if the list options would have provided some
solution but i dont think there is any.
gl
martin!
Ángel wrote: I've been looking for sometime to get a way to diferenciate odd from even items of a list. The idea would be to diferentialy decorate alternate rows of a database search result by, for instance, giving them a diferent background color (white versus light gray, eg). Any ideas, examples?
Assuming that the table is generated server-side (php, asp), use the
modulo function to determine if the row is odd or even, then insert a
style for the <td>'s.
Here's a slimmed down part from one of my pages: http://www.countryrode.com/sales/bmwnew.php
CSS:
td.cbar { background: #b0e0e6; }
PHP:
$i=0; $j=1;
while ($i < $num) {
/* Convert to variables */
$strcolor = "";
$cstocknr=mysql_result($d,$i,"cstocknr");
// Which color for this row
if ($j%2 ) { $strcolor = "class='cbar'"; }
echo "<tr>\n";
echo "<td ".$strcolor.">".$cstocknr."</td>\n";
echo "</tr>\n";
/* End of row */
$i++; $j++;
}
--
-bts
-This space intentionally left blank.
Martin! <m.*******@gmail.komkommer> wrote: Ángel wrote: I've been looking for sometime to get a way to diferenciate odd from even items of a list. The idea would be to diferentialy decorate alternate rows of a database search result by, for instance, giving them a diferent background color (white versus light gray, eg). Any ideas, examples? .odd { background-color: white; } .even { background-color: #eee; }
not much of a revolution is it.
Not at all :-)
i would have been nice if the list options would have provided some solution but i dont think there is any.
Yes, the one I was hopping for. Or, at least, for a way which would not
require to tag every item list independetly.
Thanks anyhaw :-)
Cheers,
Angel
Beauregard T. Shagnasty <a.*********@example.invalid> wrote: Ángel wrote: I've been looking for sometime to get a way to diferenciate odd from even items of a list. The idea would be to diferentialy decorate alternate rows of a database search result by, for instance, giving them a diferent background color (white versus light gray, eg). Any ideas, examples?
Assuming that the table is generated server-side (php, asp), use the modulo function to determine if the row is odd or even, then insert a style for the <td>'s.
In fact it is a PHP server side generate list. I try your solution
inserting a style for the <li>'s :-)
Thanks a lot.
Angel
"Martin!" <m.*******@gmail.komkommer> wrote: .odd { background-color: white; } .even { background-color: #eee; }
Naturally with <tr class="odd"> and <tr class="even"> for alternating
rows. But you can make things a little simpler: generate just <tr
class="even"> for even rows (and <tr> for odd rows) and use
tr { background: white; color: black; }
tr.even { background: #eee; color: block; }
(Write 100 times: "Always set color when setting background, and vice
versa, and set background image too, for safety." Setting background
instead of background-color sets background-image: none.)
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Toby Miller <tm*****@tobymiller.com> wrote: You could do it with JavaScript too, here's an example implementation:
http://www.tobymiller.com/downloads/...row_colors.htm
Thank you, but I do not use JavaScript for giving style. The CSS
aproach works very well.
Cheers,
Ángel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Simon |
last post by:
Hi,
I'm hoping you could show me examples of how a functional/declarative
language could be used to consicely describe resticted subsets of elements.
I'm looking for a 'specification' style...
|
by: M. Clift |
last post by:
Hi All,
Could someone help me out with this?
items = ('a', 'b', 'c', 'd')
items + 1 = ( 'b', 'c', 'd', 'a')
items + 2 = ( 'c', 'd', 'a', 'b')
items + 3 = ( 'd', 'a', 'b', 'c')
trans = 1
|
by: NickB |
last post by:
Please could someone tell me what is wrong.
Ther error is:
An unhandled exception of type 'System.NullReferenceException' occurred in
microsoft.visualbasic.dll
Additional information: Object...
|
by: Yoshitha |
last post by:
hi
I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the
items like 50,60,70,80,90,100.
i will...
|
by: Brian Henry |
last post by:
Since no one else knew how to do this I sat here all morning experimenting
with this and this is what I came up with... Its an example of how to get a
list of items back from a virtual mode list...
|
by: Brian Henry |
last post by:
Here is another virtual mode example for the .NET 2.0 framework while
working with the list view. Since you can not access the items collection of
the list view you need to do sorting another...
|
by: Kriston-Vizi Janos |
last post by:
Dear Mr. Kern, and Members,
Thank you very much for the fast answer, my question became
over-simplified.
My source code is appended below. It uses two text files (L.txt and
GC.txt) as input...
|
by: Jonathan Wood |
last post by:
I've been given a spec that seems unwieldy to me. As I'm pretty new to DB
design, I would appreciated any input this spec.
The site has three types of users: ADMIN, RESELLERS, and CLIENTS. The...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |