My question is:
I would like to change the color of a input
according to the value in the calculation made.
For example let's assume that the value of input name="comparar"
is 5 and the result of calculating input name="cor1"
and input name="cor2"
is 4 that will be shown in input name="cor3"
In this case as the result was 4 less than 5 would change the color from input name="cor3"
to red and if it were to the contrary would change the color from input name="cor3"
to green and if it were possible to change automatically cause a new calculation is made .
<html>
<head>
<title>CALCULO</title>
</head>
<body>
<script type="text/javascript">
function COR() {
var cor1 = eval(document.form.cor1.value);
var cor2 = eval(document.form.cor2.value);
cor3 = cor1+cor2
document.form.cor3.value = cor3;
}
</script>
<form name="form" onmouseover="COR()">
<input name="comparar" width="50%" /><br /><br /><br />
<input name="cor1" width="50%" /><br />
<input name="cor2" width="50%" /><br /><br /><br />
<input name="cor3" width="50%" /><br />
</form>
</body>
</html>