javascript addEventListener by querySelector not work
<p>HI this is my javascript code :</p>

<pre><code>window.onload = function () {

    function hideAds() {
        setTimeout(hide, 2000);
    }

    function hide() {
        var ads = document.querySelector(".ads");
        ads.style.marginTop = (-ads.offsetHeight) + "px";
    }

    function reveal() {
        ads.style.marginTop = "";
        hideAds();
    }
    var ads = document.querySelector(".ads");
    ads.addEventListener("click", reveal, true);


    hideAds();

}
</code></pre>

<p>from this code, everything work fine other then "ads.addEventListener" second line from last. what is the reason? is i made anything wrong here..?</p>

<p>i need to call my reveal function by click the ads class added div.</p>

<p>any one help me?</p>
