Você está na página 1de 2

<html>

<head><title>Rubrica#4</title></head>
<body>
<h1>Multiplicacion, division y resta</h1>
<form name = "operaciones">
Valor 1<input type = "text", name = "v1", size = "35"><br>
Valor 2<input type = "text", name = "v2", size = "35"><br>
Resultado<input type = "text", name = "res", size = "35"><br>
<input type = "button", name = "calc1", value = "Calcular" onClick = "a()"><br>
Divisor del resultado<input type = "text", name = "v3", size = "35"><br>
Resultado division<input type = "text", name = "resdiv", size = "35"><br>
<input type = "button", name = "calc2", value = "Calcular" onClick = "b()"><br>
No. que restara al resultado<input type = "text", name = "v4", size = "35"><br>
Resultado de la resta<input type = "text", name = "resrest", size = "35"><br>
<input type = "button", name = "calc3", value = "Calcular" onClick = "c()"><br>
<hr>
<h2>Binomio y trinomio</h2>
Binomio<br>
X^2-50
Valor en X<input type = "text", name = "v5", size = "35"><br>
<input type = "button", name = "calc4", value = "Calcular" onClick = "d()"><br>
Resultado<input type = "text", name = "bin", size = "35"><br>
Trinomio<br>
X^2-5X+45
Valor en X<input type = "text", name = "v6", size = "35"><br>
<input type = "button", name = "calc5", value = "Calcular" onClick = "e()"><br>
Resultado<input type = "text", name = "trin", size = "35"><br>
<script language = "JavaScript">
function a()
{
var v1, v2, res;
res = document.operaciones.v1.value * document.operaciones.v2.value;
document.operaciones.res.value = res;
}
function b()
{
var v3, resdiv;
resdiv = document.operaciones.res.value / document.operaciones.v3.value;
document.operaciones.resdiv.value = resdiv;
}
function c()
{
var v4, resrest;
resrest = document.operaciones.resdiv.value - document.operaciones.v4.value;
document.operaciones.resrest.value = resrest;
}
function d()
{
var v5, bin;
bin = document.operaciones.v5.value * document.operaciones.v5.value - 50;
document.operaciones.bin.value = bin;
}
function e()
{
var v6;
trin = (document.operaciones.v6.value * document.operaciones.v6.value) -
(document.operaciones.v6.value * 5) + 45;
document.operaciones.trin.value = trin;
}
</script>
</form>
</body>
</html>

Você também pode gostar