GMaps Api的问题

时间:2011-04-04 15:57:58

标签: javascript google-maps

从google maps api调用set center function后出现错误。

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

我不知道是什么原因。也许有人注意到类似的问题? THX

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

请尝试使用正确的参数和 像

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

请在获得解决方案后关闭帖子。