4
My question is this::
I’d like you 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 the calculation of input name="cor1"
and of input name="cor2"
be 4 which will be shown in input name="cor3"
In this case as the result was 4 less than 5 would change the color of input name="cor3"
to red and if it were the other way around it would change the color of the input name="cor3"
for green and if it was 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>
Friend exactly what I wanted Thank you !!!
– Christian Sandi