search for: in: entire forum this post
you are here: root => examples => Detecting the size of ad divs
member since:
folders:
1
posts:
4
replies:
0

Detecting the size of ad divs

example: (try enabling/disabling adblock/javascript and reloading the page to see the results)



code:
<script type="text/javascript">
function TestPage()
{
    var testaddiv = document.getElementById("myTestAd");
    var containodiv = document.getElementById("containo");
    var loaderdiv = document.getElementById("loader");
    if(testaddiv == null || containodiv == null || loaderdiv == null)
    {var t=setTimeout("TestPage()",100);}
    else
    {
        var divheight = testaddiv.offsetHeight;
        if(divheight > 0)
        {
            document.getElementById("loader").style.display = "none";
            containodiv.style.display = "block";
        }
        else
        {var t=setTimeout("TestPage()",100);}
    }
}
</script>
<div id="myTestAd">
<center>
<script type="text/javascript"><!--
google_ad_client = "pub-3427126291022263";
/* 728x90, date de création 04/10/09 */
google_ad_slot = "5027558006";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
</div>

<div class="containo" id="loader" style="display:none;">...loading page...<br />the contents of this page can only be shown once the google banner on top is loaded.<br />if youre using ad blocking extensions such as adblock or noscript please turn them off and reload the page to see the contents of the page.</div>
<script type="text/javascript">
document.getElementById("loader").style.display = "block";
TestPage();
</script>
<noscript>
<div>you need to enable javascript for this page to work</div>

</noscript>
<div class="containo" id="containo" style="display:none;">


content goes here!


</div>


post #2
permalink

moderators of this post

blockadblockman (level: ∞)
powered by Nodesforum