Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2010, 17:46
Avatar de ClubIce
ClubIce
 
Fecha de Ingreso: diciembre-2008
Mensajes: 216
Antigüedad: 15 años, 4 meses
Puntos: 2
Error en usando AppendChild

Hola,

estoy realizando un Script, para generar algo que yo llamo "Jerarquia Avanzada", entonses, lo que que hago es crear elementos dinamicamente y añadirlos a un elemento padre.

El error:

Código:
Error: uncaught exception: 
[Exception... "Node cannot be inserted at the specified point in the hierarchy"
code: "3"
nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"
location: "file:///D:/mysite/lyn/dhtml/dhtml.js
Line: 82"]
y el Script:

Código Javascript:
Ver original
  1. dhtElement = new Class({ //dhtElement es un Objeto base para crear otros
  2.   initialize:function(data){
  3.     for (prop in data) {
  4.       this[prop] = data[prop]
  5.       if (typeof(data[prop].element) != 'undefined' || data[prop].element != null) {
  6.         alert(this.element)
  7.         this.element.appendChild(data[prop].element) // linea 82
  8.       }
  9.     }
  10.   },
  11.   element:null, // Este es el elemento HTML, se coloca
  12.   x:function(){},
  13.   y:function(){},
  14.   width:function(){},
  15.   height:function(){},
  16.   draw:function(){
  17.     return this.element
  18.   }
  19. })
  20. dhtComponent = new Class({
  21.   element:$C("div")
  22. },dhtElement)
  23.  
  24. /* Layer Types */
  25.  
  26. dhtLayer = new Class({},dhtElement) // Aquí creo la sub clase
  27.  
  28. lyrDIV = new Class({
  29.   element:$C('div') //$C = document.createElement, especifico el
  30.                     //elemento que estaba en null mas arriba
  31. },dhtLayer)