Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/07/2008, 11:19
Bram
 
Fecha de Ingreso: marzo-2008
Mensajes: 80
Antigüedad: 16 años, 1 mes
Puntos: 0
Creación de botones dinamicamente con DOM

Muy buenas.

El tema es el siguiente, necesito que al hacer click a un botón se cree otro botón que hace X al hacer onclick.

he conseguido que se cree el botón, pero no que haga lo que yo deseo, aquí el ejemplo:

...
var boton= document.createElement("input");
boton.type="button";
boton.value="quitar";
boton.onclick="funcionX()";

miContainer.appendChild(boto);
//miContainer és un <p></p> que también contiene texto
...

function funcionX()
{

alert("X");
}

se crea todo bien y el firebug no detecta ningun error, pero al hacer click no hace nada. Yo entiendo que onclick es un atributo mas del input y que puedo hacer ésto, además no dá errores, pero no funciona...

podeis ver el tema aquí:
http://www.trabajillos.es/HTML/anunc...roUnProfe.html

¿alguna idea?