2011-04-04 38 views
1

我從谷歌地圖API調用set中心函數後出現錯誤。GMaps的問題Api

this.Pg is undefined 
l.rz=function(a){if(this.Nb)return this.Pg.apply(this.Nb,a)}; 

我不知道是什麼原因。也許有人發現類似的問題? THX

+3

你可能會丟失一些初始化。你能發佈你的JavaScript代碼嗎? – beetstra 2011-04-04 15:59:48

+0

@ beetstra是對的;這需要更多的上下文。 – 2011-04-04 16:01:21

回答

0

請儘量使用適當的參數和 像

 
    map.setCenter(new GLatlang(34.555,68.999), 18);

並得到解決後,請關閉線程。

4
var lat = document.getElementById("lat").value; 
var lng = document.getElementById("lng").value; 

event.LatLng = new google.maps.LatLng(lat, lng); 

center = event.LatLng; 
    var myOptions = { 
    zoom:9,// zoon 
    mapTypeId: google.maps.MapTypeId.HYBRID, 
    center: center 
       } 

latlng變量從外地來如此調整你的HTML代碼。

或..

var center = new google.maps.LatLng(lat, lng); 
       var myOptions = { 
        zoom:9,// zoon 
        mapTypeId: google.maps.MapTypeId.HYBRID, 
        center: center 

       } 

https://developers.google.com/maps/documentation/javascript/reference