• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Responsive Banner Display Issue

caliman

Active member
#1
Hi all -

I am trying to modify the responsive adsense code from resources to display banners from my banner server.
Code:
<xen:hook name="ad_header" />

<div id="ad_header">
<script type="text/javascript">
  width = document.documentElement.clientWidth;
  /* default 320 x 50 banner */

  var sc = document.createElement('script');
  sc.src = 'http://ads.domain.com/adpeeps.php?bf=showad&amp;uid=101662&amp;bmode=off&amp;gpos=center&amp;bzone=header-320&amp;bsize=all&amp;btype=3&amp;bpos=default&amp;btotal=1&amp;btarget=_blank&amp;bborder=0';



if(width > 483) {

  sc.src = 'http://ads.domain.com/adpeeps.php?bf=showad&amp;uid=101662&amp;bmode=off&amp;gpos=center&amp;bzone=header-468&amp;bsize=all&amp;btype=3&amp;bpos=default&amp;btotal=1&amp;btarget=_blank&amp;bborder=0';
}

if(width > 743) {

  sc.src = 'http://ads.domain.com/adpeeps.php?bf=showad&amp;uid=101662&amp;bmode=off&amp;gpos=center&amp;bzone=header-728&amp;bsize=all&amp;btype=3&amp;bpos=default&amp;btotal=1&amp;btarget=_blank&amp;bborder=0';
}

  sc.type = 'text/javascript';
  if(typeof sc['async'] !== 'undefined') {
     sc.async = true;
  } 

  document.getElementById('ad_header').innerHTML=sc;


</script>
</div>

I think I am in the ballpark but I am having trouble with the getElementbyId line I believe. I cannot get the banner to generate.

Any help would be greatly appreciated. Thanks in advance,

caliman
 
Last edited: