Hi

All done with Javascript.

I am using a checkbox in my gridview. When the user checks the checkbox I change the background colour of the row to Black and when it is unchecked i change the background colour (of the row) back to its original colour (something other than black). All this is working well.

The problem:

If For example I was on row 4 of a an 8 row grid and I checked the checkbox row 4 backcolour is changed to black. If I then click the checkbox on row 6 of the grid I want the the backcolour on row 6 to go black and the backcolour on row 4 to revert to its original colour. I know how to handle row 6 but cannot work out how to move to row 4 to reset the back colour.

Any help would be greatly appreciated

kind regards


Javascript Code Below

function HighlightRow(chkB)

{

var Gridid = document.getElementById('GridStock');

var Buttonid = document.getElementById('btnNextForm');

var forecolour = chkB.parentElement.parentElement.style.color;

var checked_b = chkB.checked;

var ghtest = chkB.parentNode;

var row = ghtest.parentNode;

var i = row.rowIndex

var tmp_s

var tmp_b;

tmp_s = trim(Buttonid.value)

if (tmp_s != "")

{

/*row.rowIndex = 10*/

}

HideMenu();

if (checked_b)

{

chkB.parentElement.parentElement.style.backgroundColor = 'black';

if (forecolour != "red")

{

chkB.parentElement.parentElement.style.color = 'white';

}

Buttonid.value = row.rowIndex;

mouseSelect();

}

else

{

switch_off(chkB, row, forecolour, Buttonid)

}

}



function switch_off(chkB, row, forecolour, Buttonid)

{

if (row.rowIndex % 2 == 0) {

chkB.parentElement.parentElement.style.backgroundColor = 'white';

if (forecolour != "red") {

chkB.parentElement.parentElement.style.color = 'black';

}

}

else {

chkB.parentElement.parentElement.style.backgroundColor = '#DDDDDD';

if (forecolour != "red") {

chkB.parentElement.parentElement.style.color = 'black';

}

}

Buttonid.value = "OFF";

}

function HideMenu()

{

isMenu = false;

overpopupmenu = false;

document.getElementById('menudiv').style.display = "none";

}




kind regards