0

いくつかの理由で、ハイライト行にこの JavaScript コードを使用しています。このコード ブロックに条件を追加する必要があります。このようなもの :

 function onGridViewRowSelected(rowIdx, rowIdx2) {
   //bring value via get control and assign
var selRow = getSelectedRow(rowIdx);
//Check Current Row is null or not
if (curSelRow != null) {
   //..TRIED THIS ROW
    if (curSelRow.style.backgroundColor = '#red') {
        //do nothing..
    } else {


        curSelRow.style.backgroundColor = '#ffffff';
    }
}
//come to here if not in condition and check selected row is null or not
if (null != selRow) {
//if in condition ..
    curSelRow = selRow;
    //change current selected row background color
    curSelRow.style.backgroundColor = '#ababab';
}

}

4

1 に答える 1

0

私はあなたの質問について明確ではありませんが、あなたの js コードにはバグがあります:

if (curSelRow.style.backgroundColor = '#red')  // WRONG, u can't do this
if (curSelRow.style.backgroundColor == '#red') // use color codes instead ( for red = #ff0000 ) or just red..
于 2012-05-12T07:40:21.137 に答える