Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2012, 10:34
albertcito
 
Fecha de Ingreso: diciembre-2007
Mensajes: 169
Antigüedad: 16 años, 4 meses
Puntos: 6
Pregunta Duda con JS y POO

Código:
function Calendario(){
	
	this.fecha_inicial = 0;
	this.fecha_final = 0;
	this.titulo = '';	
}

Calendario.prototype.addEvento = function(){
	alert("FI_: "+this.fecha_inicial);
}
Calendario.prototype.reservar = function(){
	
	// Recogo los datos
	var t  = jQuery('#titulo').val();
	var fi = jQuery('#fecha_inicial').val();
	var ff = jQuery('#fecha_final').val();
	var d  = jQuery('#descripcion').val();

	//Actualizo variables globales.
	this.titulo 	   = t;
	this.fecha_inicial = fi;
	this.fecha_final   = ff;
	this.descripcion   = d;
	
	Calendario.addEvento();
}
y ocupo así la clase:

Código:
var calendar = new Calendario();
jQuery('#reservar').click(calendar.reservar);
Pero me lanza el siguiente error:
Código:
Uncaught TypeError: Object function Calendario(){

	this.fecha_inicial = 0;

	this.fecha_final = 0;

	this.titulo = '';

} has no method 'addEvento'
Calendario.reservar
f.event.dispatch
f.event.add.h.handle.i

Ayuda por favor.
__________________
Inspiracion