You are on page 1of 2

<html>

<head>
<title></title>
</head>
<body>
<script type="text/javascript">

function LaSuma() {

n1=parseInt(document.getElementById("num1").value);
n2=parseInt(document.getElementById("num2").value);
document.getElementById("num3").value=n1+n2;
}

function LaResta() {

n1=parseInt(document.getElementById("num1").value);
n2=parseInt(document.getElementById("num2").value);
document.getElementById("num3").value=n1-n2;
}

function LaMultiplicacion() {

n1=parseInt(document.getElementById("num1").value);
n2=parseInt(document.getElementById("num2").value);
document.getElementById("num3").value=n1*n2;
}
function LaDivicion() {

n1=parseInt(document.getElementById("num1").value);
n2=parseInt(document.getElementById("num2").value);
document.getElementById("num3").value=n1/n2;
}

</script>

<form>

numero:<input type="text" id="num1" name="num1"> <br>


numero:<input type="text" id="num2" name="num2"><br>
Resultado:<input type="text" id="num3" name="num3"><br>
<br>

<input type="button" value="Sumar" onClick="LaSuma()">


<input type="button" value="Restar" onClick="LaResta()">
<input type="button" value="Multiplicar" onClick="LaMultiplicacion()">
<input type="button" value="Dividir" onClick="LaDivicion()">
<br>
<input type="reset" value="limpiar">
</form>

</form>

</body>
</html>

You might also like