[javaEScript] append y remove child

zar man zar- en linuxmail.org
Mar Ago 29 08:32:57 PDT 2006


Hola, escribi este pequeño script pero no me funciona. xD
Por lo que pude comprobar tirando alerts, si agrego un elemento con appendChild y luego intento getelementbyid(id nuevo) siempre me devuelve null, por lo tanto cuando quiero hacer removechild el id que busca le da null y no puede borrar. Creo entonces que el problema esta en obtener el id ¿? ..
Gracias

function add(path, id)
{
var elemento = document.getElementById('div_medio');
var imagen = document.createElement('img');
imagen.setAttribute('id', id);
imagen.src = path;
imagen.setAttribute('ondblclick', 'javascript: quitar("+ id +")');
elemento.appendChild(imagen);
}    

hasta aca funciona, agrega las imagenes en el div que debe... pero 

function del(id)
{
var elemento = document.getElementById('div_medio');
var idchild = document.getElementById(id);
elemento.removeChild(idchild);
}

-- 
__________________________________________________
Now you can search for products and services
http://search.mail.com

Powered by Outblaze


Más información sobre la lista de distribución javaEScript