JavaScript - Añadir atributo rel con funcion javascript

 
Vista:

Añadir atributo rel con funcion javascript

Publicado por Marc (1 intervención) el 12/01/2008 13:33:44
Hola a todos,

tengo el siguiente codigo:

elemento_a = document.createElement("a");
elemento_a.setAttribute("href", "imgConstruccioWeb/espais/03a.jpg");
elemento_a.setAttribute("rel", "thumbnail");
elemento_img = document.createElement("img");
elemento_img.src = "imgConstruccioWeb/espais/thumbs/03a.jpg";
elemento_a.appendChild(elemento_img);

elemento_br = document.createElement("br");
var fotos = document.getElementById('fotos');

fotos.appendChild(elemento_br);
fotos.appendChild(elemento_a);

La idea seria ir añadiendo imagenes con la funcion javascript thumbnail en el atributo rel. La funcion thumbnail me permite mostrar las fotografias de una manera oridinal/diferente. El problema es que quando añado el atributo con javascript es como si no tubiera el atributo rel. Alguien sabe que hago mal?

Gracias por adelantado.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder