生成3个随机的ad.innerHTML HTML代码

I have a script below and I want to modify row 19 to show 3 different predefined html tags. Can someone show me how to do that?

Thanks.

<script> 

  // Run after all the page elements have loaded
  window.onload = function(){ 

    // This will take care of asynchronous Google ads
    setTimeout(function() { 

      // We are targeting the first banner ad of AdSense
      var ad = document.querySelector("ins.adsbygoogle");

      // If the ad contains no innerHTML, ad blockers are at work
      if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {

        // Since ad blocks hide ads using CSS too
        ad.style.cssText = 'display:block !important'; 

        // You can put any text, image or even IFRAME tags here
        ad.innerHTML = 'Your custom HTML messages goes here';      
      }

    }, 2000); // The ad blocker check is performed 2 seconds after the page load 
  }; 

</script>
查看全部
duansao20000508
duansao20000508
2015/08/20 08:44
  • php
  • html
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复