After a checkmark is checked the background color and color of button should change. the background color and the button color changes at the moment, but when I uncheck the checkbox the background color changes back, but the color of the button stays the same. It should change back and for every time
have a javascript to change background color, but for button color this does not work.
// If checkbox is checked equipment is NOT in run, then background row equipment change to grey and Color button from red to green-->
function ChangeRowColor(chkrow,row,cel) {
var varrow = document.getElementById(row);
var varcel = document.getElementById(cel);
var varColor = "#E3CEF6";
var varColor2 = "Yellow";
if (chkrow.checked == true) {
varColor = "Grey";
varColor2="Grey";
}
varrow.style.backgroundColor = varColor;
varcel.style.backgroundColor = varColor2;
document.getElementById("b_echo_01").style.backgroundColor='green';
}
table, th, td {
border: 1px solid black;
}
button {
height:40px;
width:160px;
border: 4px;
border-radius: 20px 20px 20px 20px;
border-color:red;
color: yellow;
padding: 12px 15px;
text-align: center;
font-size: 16px;
cursor: pointer;
}
button.green,input.green {
background: green;
}
.buttonsmall{
background-color: #FF0000;
border: 4px;
border-radius: 20px 20px 20px 20px;
border-color:white;
}
.buttonsmall:hover {
background-color: green;
}
<html>
<body >
<!-- Create extra space -->
<p><br><br></p>
<p><br></p>
<div id="Echo_O01_button">
<table style="width:20%;margin-left:50px;" >
<colgroup>
<col span="3" style="background-color:#E3CEF6;">
<!--<col style="background-color:yellow"> -->
</colgroup>
<tr id="rowA">
<td width="20%"><input type="button" id = "b_echo_01" class="buttonsmall" style="height:20px;width:60px" onclick="showOrHide('Echo_O01')">
</td>
<td width="40%"><b>Echo555_O01</></td>
<td width="15%"></td>
<td id="celA" width="15%" bgcolor="yellow"><input type="checkbox" name="notinrun6" id="chkrowA" onclick="ChangeRowColor(this,'rowA','celA')"/></td>
<td width="10%"></td>
</tr>
</table>
</div> <!-- Close Div Echo_O01_button -->
<!-- <p><br></p> -->
</body>
</html>
now button color change when checkbox is checked but does not change back if checkbox is unchecked