调用 google 地图 api if (GBrowserIsCompatible()) 报缺少对象
当输入的那个地址在地图中找不到之后,其他本来能打开的地图也会出现这个问题。
项目急需,求求帮帮忙!

解决方案 »

  1.   

    http://topic.csdn.net/u/20090929/15/a3172044-8eef-4a65-bd84-6fd7e5a741ce.html
      

  2.   

    http://blog.csdn.net/xiaofanku/article/details/3588315
      

  3.   

    我的js是这样的啊,改了utf-8依然不行
    <script charset="utf-8" src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAMfk-guFd848mnquBN5sE2hTapdqtK2Hnl5DyQ9XWqz_dRHQjMxQHcA5EMoLwTISTl5JKi29gu3IJAg&sensor=false"
            type="text/javascript"></script>
    window.g = {};
        window.$ = function(id){return document.getElementById(id)};
        window.onload = function() {
         try{
            if (GBrowserIsCompatible()) {
                g.map = new GMap2($("map"));
                g.map.addControl(new GLargeMapControl());
                g.map.addControl(new GMapTypeControl());
                g.map.addControl(new GScaleControl());            g.geocoder = new GClientGeocoder();            g.getCoordinates = function(address) {
                    g.geocoder.getLatLng(
                        address,
                        function(point) {
                            if (point)
                            {
                                g.map.setCenter(point, 13);
                                var er = new GMarker(point);
                                g.map.addOverlay(er);
                                var info = "<strong>" + address + "</strong><br />坐标: " + point.lat() + "," + point.lng();
                                $("txtLongitude").value = point.lat();//经度
                                $("txtLatitude").value = point.lng();//纬度
                                er.openInfoWindowHtml(info);
                                er.__address_info = info;
                                GEvent.addListener(er, "click", function() {
                                    g.map.setCenter(this.getLatLng());
                                    this.openInfoWindowHtml(this.__address_info);
                                    $("txtLongitude").value = point.lat();//经度
                                    $("txtLatitude").value = point.lng();//纬度
                                });
                            }
                            else
                            {
                                if($("Province").value==""){
                                    document.getElementById("map").style.display="none";
                                }else{
                                    alert("无法解析该省份: " + address);
                                }
                            }
                        }
                    )
                  }
                $("btn_go").onclick = function(){
                    g.getCoordinates($("Province").value);
                }
                $("btn_go").onclick();
            }else{
                alert('不支持该浏览器');
            }
           }catch(e){ 
                alert("运行发生js错误!"); 
          }
        }
        window.onunload = function(){
           try{
                GUnload();
            }catch(e){
                //alert("卸载页面时发生js错误!");
            }
        }
      

  4.   

    在html上是没有问题的,但转成了aspx页面就报缺少对象,就那句话,现在还搞不懂,烦死了
      

  5.   

    在head之间添加
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    是一直是这样吗?刷新页面会不会有时正常呢
      

  6.   

    就是google map version 3,在网上去查