function myFunction12(){
var table1 = document.getElementById("table1").rows;
var y31;
for(var i = 2; i < table1.length; i++) {
for(var j = 4; j < 5; j++) {
y31 = table1[i].cells;
if((y31[j].innerText)>="79 %") {
y31[j].style.backgroundColor ="red";
} else if(((y31[j].innerText)>="80 %") && ((y31[j].innerText)<="89 %")) {
y31[j].style.backgroundColor ="YELLOW";
} else if((y31[j].innerText)>="90 %") {
y31[j].style.backgroundColor ="GREEN";
}
}
}
}
The above jscript selects a table value and highlights it if a condition is satisfied, but as per define condition highlighting in correct cell.
function myFunction12(){
var table1 = document.getElementById("table1").rows;
var y31;
for(var i = 2; i < table1.length; i++) {
for(var j = 4; j < 5; j++) {
y31 = table1[i].cells;
if((y31[j].innerText)>="79 %") {
y31[j].style.backgroundColor ="red";
} else if(((y31[j].innerText)>="80 %") && ((y31[j].innerText)<="89 %")) {
y31[j].style.backgroundColor ="YELLOW";
} else if((y31[j].innerText)>="90 %") {
y31[j].style.backgroundColor ="GREEN";}
}
}
}
"79or"80and"90and the%"is problematic?