[Solved] Getting to be displyed in the heading tag


I found a few mistakes in your code. You need to use

document.body.appendChild(bannerBox);

instead of

document.appendChild(bannerBox);

I ran your code after making this correction http://jsbin.com/zavoyuyife/1/edit and the bannerBox element got added to the body. You can see it in Firebug (firefox) or Chrome inspector. To make it visually appear you need to give proper height and width to the bannerAd class. In your code since you have not mentioned the CSS, it did not appear visually on the page when I ran it in JSBin.

In the makeBannerAds method, you are creating the anchor and img element but not adding to the bannerAd element.

bannerAd.className = "bannerAd";
bannerAd.style.zIndex = i;
var urlLink = document.createElement("a");
urlLink.href = adsURL[i];
var bannerIndex = document.createElement("img");
bannerIndex.src = "https://stackoverflow.com/questions/27141917/banner" + i + ".jpg";

Hope this helps.

3

solved Getting

to be displyed in the heading tag