onclick="ChangeText(this);"
wenn du mit einer ID arbeiten willst, solltest du diese auch übergeben.
und wie soll dann die id heissen? die heißt doch in jeder zeile immer anders (zB. tab1 , tab2 )Der Einwand war irreführend. Das von Dir übergebene Objekt enthält - direkt oder indirekt - die ID.
Und wie spreche / übergebe ich nun die ID an wenn ich es nicht mit this machen darf?
ich habe es nun so gemacht aber das ist auch falsch soweit war ich gestern auch schon einmal...
[...]
function ChangeText(txt)
{
var txt = "if(aktiveZeile){document.getElementById(aktiveZeile).style.backgroundColor='#cccccc';}
aktiveZeile=this.id;
ChangeTxt('text 1');
this.style.color='black';";
return txt;
}
</script>
<table>
<tr style="background: #cccccc;"
onmouseover="this.style.cursor='hand' ; this.style.backgroundColor='green' ; status='over 1'"
onmouseout="ChangeCol(this) ; status=''"
onclick="ChangeText(txt1);"
id="tab1">
<td>
1111
</td>
</tr>
</table>
<table>
<tr style="background: #cccccc"
onmouseover="this.style.cursor='hand' ; this.style.backgroundColor='green' ; status='over 2'"
onmouseout="ChangeCol(this) ; status=''"
onclick="ChangeText(txt2);"
id="tab2">
<td>
2222
</td>
</tr>
</table>
[...]