I finally solve my problem, thank for the help, and now I want to share it with others; here are the script:
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;
if(el!='tr')
{
el = el.parentElement;
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;
}
To use it just add it in the onclick event of the button.
Actually I find this script on the net, I just made some modification to it so that when I click a button it will change the color of the row. And also it will not work if your using image as your button, I don't know why, but if your using a regular button it will work fine.
I hope I may able to help someone....
iceburn17
Hi,
Can anyone can tell me how to change a table row background color when I click a button? most of the tutorial I found add the event on the TR onclick event, but that not I want.
It is possible? I really appreciate any help.
can you give me a script
thanks in advance....
iceburn17