![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 122 Pomógł: 0 Dołączył: 23.01.2006 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
mam tabelke, i chcialby za pomcoa checboxa nie tylko zaznaczyc go, ale takze zmienic kolor tła calego wiersza. Wykombinowalem takie cos: Kod <style type="text/css"> #hehe { background: #00CCFF; } </style> <script language="javascript"> var i = 0; function click() { if ( i == 0 ) { i = 1; document.getElementById('hehe').style.background = '#FF6633'; } else { i = 0; document.getElementById('hehe').style.background = '#00CCFF'; } } </script> Kod {@setvar(var="i" val=0)} <table width="400" border="1"> {@list(teachers)} <tr id="hehe" class="hehe"><td>{@math(i+1)}</td><td>{teachers['teacherNames']}</td><td>{teachers['teacherSurname']}</td><td><input type="checkbox" name="id" onchange="javascript:click();"></td></tr> {@end} </table> Ale niestety nie dziala. Gdzie co poprawic? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Przyjaciele php.pl Postów: 1 112 Pomógł: 20 Dołączył: 10.04.2005 Ostrzeżenie: (0%) ![]() ![]() |
hmm, skoro tak, to faktycznie problem leży w odpowiednim dobraniu zdarzenia na jakie ma zareagowac funkcja.
próbowałeś onclick? i jeszcze jedno, nie wiem jakie masz style, ale jezeli definiujesz w nich kolor tla dla TD, to zmiany przez JS dla TRa nic nie dadzą. Moze sproboj zamiast: Kod document.getElementById('hehe').style.background = '#FF6633'; dać: Kod var eRow = document.getElementById('hehe'); var eCells = eTR.getElementsByTagName('TD'); for (var eCell in eCells) { eCell.style.backgroundColor = '#FF6633'; } pozdr. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 5.10.2025 - 01:44 |