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>
#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>
<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?