-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCICLOS.HTML
More file actions
82 lines (67 loc) · 1.39 KB
/
CICLOS.HTML
File metadata and controls
82 lines (67 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CICLOS</title>
<script type="text/javascript">
alert("no funciona");
var c, ca, b;
function calcular()
{
//alert("funciona calcularr");
//alert(ca.value);
var numero = Number(ca.value);
var calculo = 1;
var n = 1;
while(n <= numero)
{
calculo = calculo * n;
n++;
}
c.innerHTML = calculo;
}
function inicio()
{
c = document.getElementById("caja");
ca = document.getElementById("casilla");
b = document.getElementById("boton");
//añade una funcion que va escuchar cuando el evento se dispare(cuando se hace clic)
b.addEventListener("click", calcular)
// var numeros = 1;
// var residuo;
// while(numeros <= 50)
// {
// residuo = numeros % 2;
// if(residuo == 0) //quiere decir par+++
// {
// c.innerHTML += " " + numeros;
// }
// numeros++;
// }
//NUMEROS PARES DENTRO DE LA CAJA DE 1 A 10(MOD)
//var numero = 115;
//var residuo;
//residuo = numero % 2;
//c.innerHTML = residuo;
//EJEMPLO 1 DE ITERACION
//var gritos = 10;
//while(gritos > 0)
//{
//c.innerHTML += "a";
//gritos = gritos - 1;
//}
//c.innerHTML +="S";
}
//cada vez que un ciclo ocurre se llama ITERACION//
</script>
</head>
<body>
<input type="text" id="casilla"/>
<input type="button" id="boton" value = "calcular"/>
<div id="caja">HOLA</div>
<div>COMO ESTAS</div>
<script type="text/javascript">
inicio();
</script>
</body>
</html>