Is it possible to create the selected row event though it has merge cell?
I made a table for showing list of data. This table contains merging two rows which is I really need it to look that way. The tricky problem came when I try to highlight a single row. It turns out that single TR is highlighted
script
<script type="text/javascript">
var preEl ;
var orgBColor;
var orgTColor;
function HighLightTR(el, backColor,textColor){
if(typeof(preEl)!='undefined') {
preEl.bgColor=orgBColor;
try{ChangeTextColor(preEl,orgTColor);}catch(e){;}
}
orgBColor = el.bgColor;
orgTColor = el.style.color;
el.bgColor=backColor;
try{ChangeTextColor(el,textColor);}catch(e){;}
preEl = el;
}
function Change开发者_如何学PythonTextColor(a_obj,a_color){ ;
for (i=0;i<a_obj.cells.length;i++)
a_obj.cells(i).style.color=a_color;
}
html
<tr onClick="HighLightTR(this,'#c9cc99','cc3333');" >
</tr>
How Can I highlighted the whole rows (the second column has two rows) Thank your for your helps... ^_^
The second row of the first and second columns is a different row object. You'll need to change that row's color as well.
In other words, your el
and preEl
should be multi-row, instead of one row each.
Have you considered adding/removing classes to the rows and doing the color changes in CSS instead of in JavaScript?
精彩评论