Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 1 640 Pomógł: 28 Dołączył: 13.02.2003 Skąd: Międzyrzecz/Poznań Ostrzeżenie: (0%)
|
Chcialbym zrobic kolorowanie wierszy w samym CSS/JS.
Zrobilem cos takiego, niesety nie dziala...
Jak to zrobic? Da sie w ogole? Ten post edytował kicaj_ 26.08.2004, 16:02:03 |
|
|
|
![]() |
Post
#2
|
|
|
Grupa: Zarejestrowani Postów: 91 Pomógł: 0 Dołączył: 25.02.2004 Ostrzeżenie: (0%)
|
Hmm, dawno tu nie byłem (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Czy chodzi o coś takiego: Kod <html> <head> <script type="text/javascript"> function set() { var allTDs = document.getElementsByTagName('TD'); var onColor = '#FF8000'; var offColor = '#E7E7DF'; for ( var i=0; i<allTDs.length; i++ ) { allTDs[i].onmouseover=function(){ this.style.backgroundColor = onColor; } allTDs[i].onmouseout=function(){ this.style.backgroundColor = offColor; } allTDs[i].className = "bg"; } } </script> <style type="text/css"> .bg { background-color: #E7E7DF; } </style> </head> <body onload="set()"> <table> <tr> <td>Wiersz nr 1</td> </tr> <tr> <td>Wiersz nr 1</td> </tr> </table> </body> </html> (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) Ps. Możesz 'wzbogacić' kod o kolorowanie wierszy jedynie w ramach danego elementu SPAN dopisując getElementById.. np. Kod <html>
<head> <script type="text/javascript"> function set() { var allTDs = document.getElementById('test').getElementsByTagName('TD'); var onColor = '#FF8000'; var offColor = '#E7E7DF'; for ( var i=0; i<allTDs.length; i++ ) { allTDs[i].onmouseover=function(){ this.style.backgroundColor = onColor; } allTDs[i].onmouseout=function(){ this.style.backgroundColor = offColor; } allTDs[i].className = "bg"; } } </script> <style type="text/css"> .bg { background-color: #E7E7DF; } </style> </head> <body onload="set()"> <table> <tr> <td>Wiersz nr 1</td> </tr> <span id="test"> <tr> <td>Wiersz nr 1</td> </tr> </span> </table> </body> </html> |
|
|
|
kicaj Kolorowanie Wierszy 26.08.2004, 16:00:26
kicaj Nie o to chodzilo...
Przez php/MySQL generuje lic... 26.08.2004, 17:40:52
Vir Cytatjak zrobic by byly na przemian pokolorowane
... 26.08.2004, 22:02:53
FiDO Masz "maly" blad bo kolorujesz na przemi... 26.08.2004, 22:45:32
kicaj Vir: Podobne rozwiazanie juz dostalem na webhelp.p... 26.08.2004, 23:10:56
FiDO Ano dlatego, ze uniezalezniasz sie wtedy od osoby ... 27.08.2004, 00:37:48
AyZeL Witam.
A jakbyscie rozwiazali problem kolorowania... 5.04.2006, 14:19:19
Zajec Cytat(AyZeL @ 2006-04-05 14:19:19)Witam.
A j... 5.04.2006, 19:58:03
AyZeL No dziekuje, ale chodzilo mi raczej o rozwiazanie ... 5.04.2006, 22:04:57
mike_mech Cytat(AyZeL @ 2006-04-05 22:04:57)(...) ponie... 5.04.2006, 22:49:25
TomASS Majku, ale IE nie obsługuje 'hoverów' na c... 5.04.2006, 23:09:44
AyZeL Juz wytlumaczam czemu tak chce :]
Wiec moim pozad... 5.04.2006, 23:19:21 ![]() ![]() |
|
Aktualny czas: 27.12.2025 - 21:01 |