Hi I have two select menus on my page, I want a cell color to change depending upon what values are chosen. The javascript code was kindly supplied by someone on this forum and looks like this:
The two select menus are populated from a database using ASP, the following shows what they look like and the values they contain:
The table cell i want to change color looks like this:
My problem is that for some reason the cell changes color one the first update to the select menus but doesn't change after that... can anyone help me out?
Cheers
Code:
<script>
function changeCol(){
if(document.getElementById('currlikli').value != "" && document.getElementById('currSev').value != ""){
var colval = document.getElementById('currlikli').value * document.getElementById('currSev').value;
if(colval =0){colval = "#FFFFFF";}
if(colval >6){colval = "#00FF00";}
if(colval <=10){colval = "#FFFF33";}
if(colval <=15){colval = "#FF8800";}
if(colval >=16){colval = "#FF0000";}
document.getElementById('cell_rating').style.backgroundColor = colval;
}
}
</script>
The two select menus are populated from a database using ASP, the following shows what they look like and the values they contain:
Code:
<Select id="currlikli" name="currlikli" onchange="changeCol();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</Select>
<Select id="currSev" name="currSev" onchange="changeCol();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</Select>
The table cell i want to change color looks like this:
Code:
<td name="cell_rating" id="cell_rating" width="15%">
My problem is that for some reason the cell changes color one the first update to the select menus but doesn't change after that... can anyone help me out?
Cheers