0

I want to code so the window open with Javascript for Google Adsense banner. But I don't know how. I show you my code:

    <div id="ad"> 
    <div> 
        <script type="text/javascript" language="JavaScript">
        <!-- function DoHideIFRAME(tid1,tid2,tid3) {
                document.getElementById(tid1).style.display = "none"; 
                document.getElementById(tid2).style.display = "none"; 
                document.getElementById(tid3).style.display = ""; 
            } //-->
        </script>
        <div id="postads"> 
            <a border="0" id="hideiframe" onclick="DoHideIFRAME('hideiframe','postads1','viewiframe');"> 
            <img src="img/adclose.png" width="5" height="5"> 
            </a> 
        </div> 
        <br/><br/> 
        <div id="postads1"> <script type="text/javascript">
            <!-- google_ad_client = "ca-pub-xxxxxxxxxxxx"; /* Adversitement */ google_ad_slot = "xxxxxxxxx"; google_ad_width = 300; google_ad_height = 250; //--> </script> 
            <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> 
        </div> 
    </div>
    <div> 
        <script type="text/javascript" language="JavaScript">
            <!-- function DoViewIFRAME(tid1,tid2,tid3) { 
                    window.open (); 
                    document.getElementById(tid1).style.display = "none"; 
                    document.getElementById(tid2).style.display = ""; 
                    document.getElementById(tid3).style.display = ""; 
                } 
                function DoHideIFRAME(tid1,tid2,tid3) { 
                    document.getElementById(tid1).style.display = "none"; 
                    document.getElementById(tid2).style.display = "none"; 
                    document.getElementById(tid3).style.display = ""; 
                } //-->
        </script> 
    </div> 
</div> 

I added so with this code: window.open (); in function from of DoViewIFRAME(tid1,tid2,tid3).

But it doesn't work. Why? What is the problem?

  • Your function `DoHideIFRAME` is present twice. Also, your `div`s are unmatched. – John Dvorak Mar 16 '13 at 06:47
  • You shouldn't wrap `script` contents in ``. The need to do it is long gone, and I'm not sure this is the correct way to do it. – John Dvorak Mar 16 '13 at 06:51
  • @JanDvorak I have to edit it. I deleted one last `div`. Mhh.. I can't so unterstand it. :/ – Christz Leese Mar 16 '13 at 06:53
  • Concerning the HTML comments, see http://lachy.id.au/log/2005/05/script-comments and http://stackoverflow.com/questions/808816/are-html-comments-inside-script-tags-a-best-practice – John Dvorak Mar 16 '13 at 06:58
  • To the point: Please clarify "doesn't work". What does it do? What is it expected to do? – John Dvorak Mar 16 '13 at 07:03
  • @JanDvorak no with javascript is all ok. But if he click on google adsense banner with this javascript, then it isn't going to new window. I want to make, that window.open ill working. – Christz Leese Mar 16 '13 at 13:38

0 Answers0