Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/04/2012, 12:31
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 15 años, 8 meses
Puntos: 139
Respuesta: El constructor de este objeto no me funciona! (ver código)

El div no tiene evento de onLoad

Intenta con esto

Código Javascript:
Ver original
  1. /*Definiendo la clase */
  2. var ClaseDePrueva = function (array1,array2){
  3. /*contructor*/
  4.  this.texto1 = array1;
  5.  this.NombreID = document.getElementById(array2);
  6.  
  7.  /* Metodo */
  8. this.ImprimirTexto = function(){
  9.  this.NombreID.innerHTML = this.texto1;
  10. }
  11.  
  12.  
  13. }
  14.  
  15.  
  16. /*Inicializo el objeto y le paso las variables para el constructor! */
  17.  
  18. window.onload = function(){
  19. var ObjetoDePrueva = new ClaseDePrueva('ArrayDeprueva1' , 'Mydiv1');
  20. ObjetoDePrueva.ImprimirTexto();
  21. }