-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
86 lines (84 loc) · 2 KB
/
Copy pathindex.html
File metadata and controls
86 lines (84 loc) · 2 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
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<script>
var ini,fin,rango;
var arrSelec = [];
var arrTodo = [];
function validateForm() {
debugger;
var i,j=0;
ini = parseInt(document.forms["formrifa"]["txt_inicio"].value);
fin = parseInt(document.forms["formrifa"]["txt_fin"].value);
rango = fin-ini;
for(i=0;i<=rango;i++){
arrTodo[i] = ini+i;
}
}
function generarNumero() {
debugger;
var existe = false;
var i,j,longi,longselec,elegido,numero=0,k=0;
//var strSelecccionados = document.getElementById('arr_seleccionados');
var numero = parseInt(document.getElementById('txt_numero').value);
var arrYa = [];
var arrFalta = [];
longi = arrSelec.length;
if(longi == 0 && !isNaN(numero)){
arrSelec[0] = numero;
} else if (longi > 0){
for(j=0;j<longi;j++){
existe == false;
if(numero == arrSelec[j]){
existe = true;
}
}
if(existe == false){
arrSelec[longi] = numero;
}
}
existe = false;
/*
Armamos el array de faltantes
*/
longi = arrSelec.length;
debugger;
if(longi == 0){
arrFalta = arrTodo;
} else {
for(i=0;i<=rango;i++){
existe = false;
for(j=0;j<longi;j++){
if(arrTodo[i] == arrSelec[j]){
existe = true;
}
}
if(existe == false){
arrFalta[k] = arrTodo[i];
k++;
}
}
}
debugger;
longselec = arrFalta.length;
if(longselec > 0){
elegido = Math.floor((Math.random() * longselec));
document.getElementById("arr_seleccionados").value = arrFalta.join();
} else {
alert("No hay valores");
}
document.getElementById('txt_numero').value = "";
}
</script>
</head>
<body>
<form name="formrifa" action="" method="post">
Inicio: <input type="text" name="txt_inicio" id="txt_inicio">
Fin: <input type="text" name="txt_fin" id="txt_fin">
Numero: <input type="text" name="txt_numero" id="txt_numero">
<textarea rows="6" cols="50" name="arr_seleccionados" id="arr_seleccionados" value="" ></textarea>
<input type="button" onclick="validateForm()" value="Reg">
<input type="button" onclick="generarNumero()" value="Gen">
</form>
</body>
</html>