I have a page with 60 different inputs. They are all numbers and need to be checked against one of the inputs. If that input is 3 greater than the parent div changes to red. Everything works beautifully except if I try to print the style I give through my javascript function (document.getElementById(classid).style.backgroundColor = "red";) does not display print. How do I get the page to print with the style given by the function?
<script type="text/javascript">
function CheckThisNumber(val, id){
var x = document.getElementById("a6").value;
var y = Number(x) +3;
var classid = "p" + id;
if((val)>=y) {
document.getElementById(classid).style.backgroundColor = "red"; }
else { document.getElementById(classid).style.backgroundColor = "white"; }
}
</script>
One of the many inputs:
<div class="a1" id="pa1">
<strong>A1</strong><br><input type="number" name="a1" id="a1" style="width:95%" onKeyUp="CheckThisNumber(this.value,this.id)">
</div>