Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
js-e002
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fernando David Lopez
js-e002
Commits
6dc11985
Commit
6dc11985
authored
Oct 19, 2018
by
roshka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unos arreglos en el codigo de calculadora
parent
a58a7a49
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
Calculadora/calculadora.html
+1
-1
Calculadora/funciones.js
+22
-16
No files found.
Calculadora/calculadora.html
View file @
6dc11985
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
</table>
</table>
</div>
</div>
<br>
<br>
<button
id=
"
borr
ar"
>
CE
</button>
<button
id=
"
elimin
ar"
>
CE
</button>
<button
id=
"division"
>
/
</button>
<button
id=
"division"
>
/
</button>
<button
id=
"multi"
>
*
</button>
<button
id=
"multi"
>
*
</button>
<br>
<br>
...
...
Calculadora/funciones.js
View file @
6dc11985
function
variables
()
{
function
variables
()
{
var
resultado
=
document
.
getElementById
(
'resultado'
);
var
resultado
=
document
.
getElementById
(
'resultado'
);
var
suma
=
document
.
getElementById
(
'suma'
);
var
suma
=
document
.
getElementById
(
'suma'
);
var
borrar
=
document
.
getElementById
(
'borr
ar'
);
var
eliminar
=
document
.
getElementById
(
'elimin
ar'
);
var
resta
=
document
.
getElementById
(
'resta'
);
var
resta
=
document
.
getElementById
(
'resta'
);
var
multi
=
document
.
getElementById
(
'multi'
);
var
multi
=
document
.
getElementById
(
'multi'
);
var
division
=
document
.
getElementById
(
'division'
);
var
division
=
document
.
getElementById
(
'division'
);
...
@@ -54,38 +54,37 @@ ocho.onclick = function(e){
...
@@ -54,38 +54,37 @@ ocho.onclick = function(e){
nueve
.
onclick
=
function
(
e
){
nueve
.
onclick
=
function
(
e
){
resultado
.
textContent
=
resultado
.
textContent
+
"9"
;
resultado
.
textContent
=
resultado
.
textContent
+
"9"
;
}
}
borrar
.
onclick
=
function
(
e
){
eliminar
.
onclick
=
function
(
e
){
borrar
();
}
suma
.
onclick
=
function
(
e
){
operandor1
=
resultado
.
textContent
;
operacion
=
"+"
;
borrar
();
borrar
();
}
}
resta
.
onclick
=
function
(
e
){
resta
.
onclick
=
function
(
e
){
resultado
.
textContent
=
resultado
.
textContent
+
"-"
;
operandor1
=
resultado
.
textContent
;
operandor1
=
resultado
.
textContent
;
operacion
=
"-"
;
operacion
=
"-"
;
borrar
();
//
borrar();
}
}
multi
.
onclick
=
function
(
e
){
multi
.
onclick
=
function
(
e
){
resultado
.
textContent
=
resultado
.
textContent
+
"*"
;
operandor1
=
resultado
.
textContent
;
operandor1
=
resultado
.
textContent
;
operacion
=
"*"
;
operacion
=
"*"
;
borrar
();
//
borrar();
}
}
division
.
onclick
=
function
(
e
){
division
.
onclick
=
function
(
e
){
resultado
.
textContent
=
resultado
.
textContent
+
"/"
;
operandor1
=
resultado
.
textContent
;
operandor1
=
resultado
.
textContent
;
operacion
=
"/"
;
operacion
=
"/"
;
borrar
();
//
borrar();
}
}
igual
.
onclick
=
function
(
e
){
igual
.
onclick
=
function
(
e
){
operandor2
=
resultado
.
textContent
;
resultado
.
textContent
=
resultado
.
textContent
;
borrar
();
//
borrar();
}
}
function
borrar
()
{
function
borrar
()
{
resultado
.
textContent
=
"
"
;
resultado
.
textContent
=
"
"
;
}
}
function
operaciones
(
params
)
{
function
operaciones
()
{
var
ecuacion
=
0
;
var
ecuacion
;
switch
(
operacion
)
{
switch
(
operacion
)
{
case
"+"
:
case
"+"
:
ecuacion
=
parseFloat
(
operandor1
)
+
parseFloat
(
operandor2
);
ecuacion
=
parseFloat
(
operandor1
)
+
parseFloat
(
operandor2
);
...
@@ -100,5 +99,11 @@ function operaciones(params) {
...
@@ -100,5 +99,11 @@ function operaciones(params) {
ecuacion
=
parseFloat
(
operandor1
)
/
parseFloat
(
operandor2
);
ecuacion
=
parseFloat
(
operandor1
)
/
parseFloat
(
operandor2
);
break
;
break
;
}
}
resultado
.
textContent
=
ecuacion
;
}
suma
.
onclick
=
function
(
e
){
resultado
.
textContent
=
resultado
.
textContent
+
"+"
;
operandor1
=
resultado
.
textContent
;
operacion
;
// borrar();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment