
Ocultar Tabla Si La Fecha Actual A Pasado La Fecha Asignada.
Publicado por Luis (24 intervenciones) el 28/01/2017 17:51:24
Buenas, Lo Que Quiero Es Que Las Tablas Se Eliminen U Oculten Si Su fecha A Caducado, Lo Que quiero Es Que sea Una Sola Funcion Para todas Las Tablas. :)
HTML
JavaScript
HTML
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
<body onload="OcultarPorFecha()">
<!-- Objetivo: Se Agregan Los Partidos Por Liga, Los Que Más Se Puedan. Segundo: dependiendo De la Fecha En La Que Jueguen Así Mismo Se Mostrara, Si El Usuario Quiere Ver Los Partidos De La Liga Sea Cual Sea, Solo Mirará Los De la Semana Actual, Sin Importar Que En El Código Madre esten Todas Las Fechas. Tercero: En Días Se Mostrara Los Partidos De Hoy, ya Que El
Código Hara Una Pregunta.- Quien juega Hoy D/M/A ? Y Los Partidos Que Esten dentro De Este Parametro De semana Se Mostraran. Cuarto: Cuando El partido Llegue A Su Momento De Inicio, Este Se Eliminara De El Cuadro De Apuestas. Y Se Pasara A Un En Vivo, Aunque Esta Opcion Aún No La Tengo Muy Clara. -->
<!-- MANOS A LA OBRA Y QUE DIOS ME AYUDE. ESTA SERA LA MEJOR PÁGINA WEB DE APUESTAS DEL MUNDO. -->
<div id="Liga-Española" class="Liga-Española-Primera-Division">
<div id="Titulo-De-Cada-Liga">
<h1>Liga Española (Primera División)</h1>
</div>
<div id="Subtitulo-De-Cada-Liga">
<span> Resulatdo 1 x 2</span>
</div>
<div id="Cuerpo-De-cada-Liga">
<table id="first">
<tbody>
<tr>
<td class="date-team">
15 De Febrero 2017 a Las 17:30 <input type="hidden" name="fechahorainicio" id="fecha_1" value="26-01-2017 03:34" />
</td>
<td class="mb-option-button" title="">
<button type="submit" class="button">
<div class="name-team-option">Deportiva La Coruña</div>
<div class="name-value-option">3.60</div>
</button>
</td>
</tr>
</tbody>
</table>
<table id="second">
<tbody>
<tr>
<td class="date-team">
2 De Febrero 2017 a Las 12:30 <input type="hidden" name="fechahorainicio" id="fecha_2" value="26-01-2017 12:33" />
</td>
<td class="mb-option-button" title="">
<button type="submit" class="button">
<div class="name-team-option">Brasil</div>
<div class="name-value-option">3.60</div>
</button>
</td>
</tr>
</tbody>
</table>
<table id="third">
<tbody>
<tr>
<td class="date-team">
26 De Enero 2017 a las 20:45<input type="hidden" name="fechahorainicio" id="fecha_3" value="29-01-2017 20:45"></input>
</td>
<td class="mb-option-button" title="">
<button type="submit" class="button">
<div class="name-team-option">Barcelona</div>
<div class="name-value-option">3.60</div>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
JavaScript
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
<script>
function OcultarPorFecha (){
var fechaActual = new Date ();
var fechaInicioPartido;
for (ix=1;document.getElementById("fecha_" + ix);ix ++){
fechaInicioPartido = construyeFecha(document.getElementById("fecha_" + ix ).value);
if (fechaActual > fechaInicioPartido){
document.getElementById("first").style.display = "none";
}
}
}
function construyeFecha(stringfecha){
var dia = parseInt(stringfecha.substring(0,2));
var mes = parseInt(stringfecha.substring(3,5)) - 1;
var anio = parseInt(stringfecha.substring(6,10));
var hora = parseInt(stringfecha.substring(11,13));
var minuto = parseInt(stringfecha.substring(14,16));
return new Date(anio, mes, dia, hora, minuto);
}
</script>
Valora esta pregunta


0