Commit 626ce815 by roshka

sorry profesor, no me estaba funcionando el internet por eso nomas tarde en subir

parents
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
table{
width: 50%;
margin: auto;
}
td{
padding: 30px;
}
</style>
<script type="text/javascript">
var n = "";
var a1 = 0;
function capturar(a){
b = a;
}
function mostrar(){
var dis = document.getElementById("display");
if (b=="1" || b=="2" || b=="3" || b=="4" || b=="5" || b=="6" || b=="7" || b=="8" || b=="9" || b=="0") {
n = n + b;
dis.innerHTML = n;
}
if (b=="+") {
dis.innerHTML = "";
a1 = a1 + parseInt(n);
n = "";
}
if (b=="-") {
dis.innerHTML = "";
if (a1!=0) {
a1 = a1 - parseInt(n);
n = "";
}
}
if (b=="x") {
dis.innerHTML = "";
a1 = a1 * parseInt(n);
n = "";
}
if (b=="=") {
dis.innerHTML = a1;
}
}
</script>
</head>
<body>
<table border="1">
<tr>
<td colspan="4" id="display"></td>
</tr>
<tr>
<td onclick="capturar('1'); mostrar()">1</td><td onclick="capturar('2'); mostrar()">2</td><td onclick="capturar('3'); mostrar()">3</td><td onclick="capturar('+'); mostrar()">+</td>
</tr>
<tr>
<td onclick="capturar('4'); mostrar()">4</td><td onclick="capturar('5'); mostrar()">5</td><td onclick="capturar('6'); mostrar()">6</td><td onclick="capturar('-'); mostrar()">-</td>
</tr>
<tr>
<td onclick="capturar('7'); mostrar()">7</td><td onclick="capturar('8'); mostrar()">8</td><td onclick="capturar('9'); mostrar()">9</td><td onclick="capturar('x'); mostrar()">x</td>
</tr>
<tr>
<td onclick="capturar('0'); mostrar()" id="">0</td><td onclick="capturar('ce'); mostrar()"><-ce</td><td onclick="capturar('='); mostrar()" colspan="2">=</td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment