JavaScript - Calendario con recordatorios de eventos

 
Vista:

Calendario con recordatorios de eventos

Publicado por Rich (2 intervenciones) el 12/05/2015 23:13:58
tal vez me puedan ayudar...
Eh estado buscando la forma de crear un calendario en javascript para programar eventos…En fin lo que busco es que cuando se allá programado un evento para un día cualquiera me avise en dicho día mediante una alerta.



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
87
88
89
90
91
92
93
94
<script type="text/javascript">
//fecha
var  today = new Date();
var m = today.getMonth() + 1;
var mes = (m < 10) ? '0' + m : m;
  document.write('Fecha: '+today.getDate(),'/' +mes,'/'+today.getYear());
//------
var jsalarm={
	padfield:function(f){
		return (f<10)? "0"+f : f
	},
	showcurrenttime:function(){
		var dateobj=new Date()
		var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateobj.getSeconds())
		this.ctref.innerHTML=ct
		this.ctref.setAttribute("title", ct)
		if (typeof this.hourwake!="undefined"){ //if alarm is set
			if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){
				clearInterval(jsalarm.timer)
				window.location=document.getElementById("musicloc").value
 
			}
		}
	},
	init:function(){
		var dateobj=new Date()
		this.ctref=document.getElementById("jsalarm_ct")
		this.submitref=document.getElementById("submitbutton")
		this.submitref.onclick=function(){
			jsalarm.setalarm()
			this.value="Alarm Set"
			this.disabled=true
			return false
		}
		this.resetref=document.getElementById("resetbutton")
		this.resetref.onclick=function(){
		jsalarm.submitref.disabled=false
		jsalarm.hourwake=undefined
		jsalarm.hourselect.disabled=false
		jsalarm.minuteselect.disabled=false
		jsalarm.secondselect.disabled=false
		return false
		}
		var selections=document.getElementsByTagName("select")
		this.hourselect=selections[0]
		this.minuteselect=selections[1]
		this.secondselect=selections[2]
		for (var i=0; i<60; i++){
			if (i<24) //If still within range of hours field: 0-23
			this.hourselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours()==i)
			this.minuteselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes()==i)
			this.secondselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds()==i)
 
		}
		jsalarm.showcurrenttime()
		jsalarm.timer=setInterval(function(){jsalarm.showcurrenttime()}, 1000)
	},
	setalarm:function(){
		this.hourwake=this.hourselect.options[this.hourselect.selectedIndex].value
		this.minutewake=this.minuteselect.options[this.minuteselect.selectedIndex].value
		this.secondwake=this.secondselect.options[this.secondselect.selectedIndex].value
		this.hourselect.disabled=true
		this.minuteselect.disabled=true
		this.secondselect.disabled=true
		this.MsgBox.musiclo
	}
}
function MsgBox(text){
     alert(text);
     return;
}
 
 
</script>
 
 
 
<form action="" method="">
<div id="jsalarmclock">
<div><div class="leftcolumn">Hora Actual:</div> <span id="jsalarm_ct" style="letter-spacing: 2px"></span></div>
<div><div class="leftcolumn">Programar Evento:</div> <span><select></select> Hour</span> <span><select></select> Minutes</span> <span><select></select> Seconds</span></div>
<div><div class="leftcolumn">Fecah de evento:</div><input type="date"   step="1" min="2010-01-01" max="2015-12-31" name="fecha1"</div>
<div><div class="leftcolumn">Evento:</div> <input type="text" id="musicloc" size="55" value="" /> <span style="font: normal 11px Tahoma">*Location of page to launch</span></div>
<input type="Button" value="Muestra">
<input type="submit" value="Activar" id="submitbutton"  /> <input type="reset" value="reset" id="resetbutton"  />
</div>
</form>
 
 
<script type="text/javascript">
 
jsalarm.init()
 
</script>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Vainas
Val: 95
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

Calendario con recordatorios de eventos

Publicado por Vainas (258 intervenciones) el 14/05/2015 11:16:18
Buenas:

Para empezar: a tu codigo le faltan todos los ";" asi que ponselos donde corresponde. Ya se que en algunos casos no es necesario pero es mejor asi luego no dara fallos.

A mi me da fallo aqui(linea 65):

1
this.MsgBox.musiclo

Y por esto el submit recarga la pagina.

yo creo que deberia ser algo asi:

1
this.MsgBox(document.getElementById("musicloc").value);


Espero que te sirva de algo.

Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

Calendario con recordatorios de eventos

Publicado por Rich (2 intervenciones) el 14/05/2015 14:37:04
Muchas gracias......Agradesco tu ayuda..
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar