1
On my website, I create a div
dynamically, after the second paragraph (forum).
I’d like to position a banner already loaded inside that div
.
tried several ways, to give a apendchild
, but it won’t.
Here is the site URL to understand:
Below the code I’m using to create the div
:
var meupost = document.getElementsByClassName("post entry-content ")[0];
var meudiv = meupost.getElementsByTagName("p")[1];
var meubanner = document.createElement("div");
meubanner.id = "banner300x250-1-auto";
meubanner.setAttribute('class','ipsBox_container');
meubanner.style.height = "250px";
meubanner.style.width = "300px";
//meubanner.style.position = "relative";
meubanner.style.float= "right";
meupost.insertBefore(meubanner, meudiv);
What do you want to put there? It would be the
#google_image_div
? It would also be good to show what you tried to do (and it didn’t work out), so we can see what’s wrong.– mgibsonbr
P.S. I tried to simply select any element and put it on
div
created usingappendChild
and worked normally: http://jsfiddle.net/99mshwn8/– mgibsonbr