Hi - I have been fighting with this for a couple of days now. I have a dynamic table that is built via a query which has a checkbox at the beginning of the row. When a user clicks or checks a checkbox I need to have the row highlight to a different color and then if the user unchecks the checkbox I need to have the row go back to the original color. Below is my code at this point. I can get the row to highlight, but I cannot get the row to un-highlight when I check it again.

Thanks in advance for the help!

<script type="text/javascript"><!--

function gregtest2()
{
var message = '';
for (var i = 0; i <= 249; i++) {
testchecked = document.form.elements[i].checked;
if (testchecked == true) {
try{HighLightTR('white','cc3333');}catch(e){;}
}
if (testchecked == false) {
try{HighLightTR('gold','cc3333');}catch(e){;}
}
// document.form.price.value = ('$' + document.form.price.value);
// $price = document.form.price.value;
}
}


</script>

<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;
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>