onclick = highlight row
Posted: Tue Nov 11, 2003 4:44 am
i have a table to display the record. when i onclick the row, it will highlight entire row. But i got a problem, when i click the hyperlink in one of the cell, it only highlight that cell only. But i want to highlight entire row.
Anyone can help me ? thank you............
below is coding :
Anyone can help me ? thank you............
below is coding :
Code: Select all
<?php
echo" <tr onClick="HighLightTR('#c9cc99','cc3333');" >";
echo'
<td width="6%" >'.$no.'</td>
<td width="14%"><a href="add_race.php">'.$Ecat.'</a></td>
</tr>
?>Code: Select all
<script language="JavaScript1.2">
var preEl ;
var orgBColor;
var orgTColor;
function HighLightTR(backColor,textColor){
if(typeof(preEl)!='undefined') {
preEl.bgColor=orgBColor;
try{ChangeTextColor(preEl,orgTColor);}catch(e){;}
}
var el = event.srcElement;
el = el.parentElement;
orgBColor = el.bgColor;
orgTColor = el.style.color;
el.bgColor=backColor;
try{ChangeTextColor(el,textColor);}catch(e){;}
preEl = el;
}
function ChangeTextColor(a_obj,a_color){ ;
for (i=0;i<a_obj.cells.length;i++)
a_obj.cells(i).style.color=a_color;
}
</script>