como repetir el resultado de una funcion en java script
Publicado por liantony (7 intervenciones) el 13/12/2016 16:41:10
hola tengo una duda de como hacer que una funcion se repita tanto numero de veces como sea posible estoy usando este codigo
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
<!DOCTYPE html>
<html>
<body>
<p>generar 4 numero_ entre 1 y 47 .</p>
<button onclick="myFunction()"; >Try it</button>
<p id="demo"> </p>
<p id="demo_l" > </p>
<p id= "demo_1" > </p>
<p id="demo_2"> </p>
<script>
var resultado = myFunction;
function myFunction( ) {
var w = document.getElementById("demo")
var q= document.getElementById("demo_1")
var c= document.getElementById("demo_l")
var x= document.getElementById("demo_2")
x.innerHTML = Math.floor((Math.random() * 47) + 1);
c.innerHTML = Math.floor((Math.random() * 47 ) + 1);
w.innerHTML = Math.floor((Math.random() * 47) + 1);
q.innerHTML = Math.floor((Math.random() * 47) + 1);
}
var x = 1 ;
while(x<=10 ) {
document.write(x+ "" );
x++;
}
</script>
</body>
</html>
Valora esta pregunta
0