Forum Moderators: open
Here is my code:
function mark_tr(row_id, col_num){
var row = parseInt(row_id.id.split('_')[1] ) + 1;
var cell;
var bgcolor;
for(var col = 0; col < 1; col++) {
cell = document.getElementById("a" + row.toString() + "#" + (col).toString());
style = cell.getAttribute('style');
bgcolor = style.getAttribute("backgroundColor");
bgcolor = bgcolor.replace('#',"");
bgcolor = parseInt(bgcolor, 16) * 8;
bgcolor = bgcolor.toString(16); // I tried also "#" + bgcolor.toString(16);
// To this spot every thing is good
try {
// This line seems not to do what I want it to do
// There is no exception in this line
cell.style.setAttribute('backgroundColor', bgcolor);
} catch(e) { alert('Exception:\n' + e); alert('\nbgcolor:\n' + bgcolor);}
style = cell.getAttribute('style');
bgcolor = style.getAttribute("backgroundColor");
// bgcolor has not been changed at all!
alert(bgcolor);
}
This code does not work. I have also tried meny othere ways to set the color but without success.
Does anybody knows how to solve this problem?
Thanks,