• 解决google 广告加载 慢 的问题


    <!--  google广告代码加载-->
    <script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script>
    <script type="text/javascript">
    GS_googleAddAdSenseService("ca-pub-3437941256594093");
    GS_googleEnableAllServices();
    </script>
    <script type="text/javascript">
    GA_googleAddSlot("ca-pub-3437941256594093", "anjuke_shanghai_homepage_bottom_728x90");
    GA_googleAddSlot("ca-pub-3437941256594093", "anjuke_shanghai_homepage_right_200x200");
    </script>
    <script type="text/javascript">
    GA_googleFetchAds();
    </script>



    <!-- google广告位置填充 -->
    <div id="anjuke_shanghai_homepage_bottom" style="display: none;">
    <script type="text/javascript">
    if($('adanjuke_zoneid_1002')){
    GA_googleFillSlot("anjuke_shanghai_homepage_bottom_728x90");
    }
    </script>
    </div>
    <!-- google广告位置填充 -->
    <div id="anjuke_shanghai_homepage_right" style="display: none;">
    <script type="text/javascript">
    if($('adanjuke_zoneid_1003')){
    GA_googleFillSlot("anjuke_shanghai_homepage_right_200x200");
    }
    </script>
    </div>

    <!-- 广告的迁移-->
    <script type="text/javascript">

    var get = function(id) {
    return document.getElementById(id);
    }

    var moved_ads = ['cproIframe1','cproIframe2','cproIframe3'];
    var moved_num = 0;
    var anjuke_ad_move = function(type,slot,target,id) {
    if(type == 'google'){
    var adslot = get(target), ifrm, ad_frame = get('google_ads_iframe_' + slot);
    }else if(type == 'baidu'){
    var adslot = get(slot), ifrm, ad_frame = get('baidu_clb_slot_iframe_' + id);
    }else{
    return;
    }

    if (adslot == null){
    return;
    }

    if(type == 'baidu' && ad_frame == null){
    var ad_id = moved_ads[moved_num];
    ad_frame = get(ad_id);
    if(ad_frame){
    moved_num++;
    }
    }

    if (ad_frame) {
    ifrm = document.createElement('iframe');
    ifrm.setAttribute('id', type+'_ads_slot_iframe_' + slot);
    ifrm.setAttribute('frameBorder', 0);
    ifrm.setAttribute('scrolling', 'no');
    ifrm.setAttribute('width', ad_frame.getAttribute('width'));
    ifrm.setAttribute('height', ad_frame.getAttribute('height'));
    adslot.appendChild (ifrm);
    if(ad_frame.src && ad_frame.src.indexOf('http') != -1){
    ifrm.src = ad_frame.src;
    }else{
    ifrm.contentWindow.document.open();
    ifrm.contentWindow.document.write(ad_frame.contentWindow.document.documentElement.innerHTML);
    ifrm.contentWindow.document.close();
    }

    } else {
    if(type == 'google'){
    var ad_div = get('google_ads_div_' + slot) || get('google_ads_div_' + slot + '_ad_container');
    }else{
    var ad_div = get(target);
    ad_div.style.display = "block";
    }

    if (ad_div) {
    adslot.innerHTML = ad_div.innerHTML;
    }
    }

    adslot.style.display = '';
    }

    setTimeout("anjuke_ad_move('google','anjuke_shanghai_homepage_bottom_728x90','adanjuke_zoneid_1002')", 0);
    setTimeout("anjuke_ad_move('google','anjuke_shanghai_homepage_right_200x200','adanjuke_zoneid_1003')", 100);
    </script>


    <script>
  • 相关阅读:
    转载:ORA-01438: 值大于为此列指定的允许精度
    PLSQL碰到pls-00103的错误解决办法
    spring 的xml配置使用p标签简化
    spring aop实现拦截接口请求打印日志
    response 设置头的类型 (转)
    js或者ext js获取返回值
    ext grid 前台grid加载数据碰到数据重复只显示一条
    关于struts和Spring 结合到一起之后存在ACtion创建单实例还是多
    SVN提交碰到的问题奇怪的问题
    关于项目使用可配置的properties 文件的实现
  • 原文地址:https://www.cnblogs.com/jonhson/p/2226945.html
Copyright © 2020-2023  润新知