<script  type="text/javascript">
var _bdhm_top = 0;
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
var _bdhm_tim = new Image(1,1);
_bdhm_tim.id = "bdhmPerimg";
_bdhm_tim.src = _bdhmProtocol + "hm.baidu.com/_tt.gif?si=0a54b19a13b6712dc04d1b49215423d8&rnd=" + Math.round(Math.random()*2147483647);
_bdhm_tim.onload=function(){_bdhm_top = 1;}
</script>

解决方案 »

  1.   


    var _bdhm_top = 0;
    //取网页地址.判断是否为安全站点
    var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    //新建图片.
    var _bdhm_tim = new Image(1,1);
    //图片ID
    _bdhm_tim.id = "bdhmPerimg";
    //图片地址.加Math.round()为了实现浏览器兼容.防止不跳转不显示
    _bdhm_tim.src = _bdhmProtocol + "hm.baidu.com/_tt.gif?si=0a54b19a13b6712dc04d1b49215423d8&rnd=" + Math.round(Math.random()*2147483647);
    //该图片加载调用的方法
    _bdhm_tim.onload=function(){_bdhm_top = 1;}
      

  2.   

    从 hm.baidu.com  加载一张图片,加载成功后设置 _bdhm_top = 1;