Google地图请求返回“Can not set property'position of undefined” [英] Google maps request returning "Cannot set property 'position' of undefined"
本文介绍了Google地图请求返回“Can not set property'position of undefined”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用goolge贴图在地图上显示一个位置,使用下面的函数:
Am trying to display a location on a map using goolge maps, with the function below
function show_map(options) {
var mapOptions = {
center: new google.maps.LatLng(options.lat, options.lng),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map($("#map-canvas"),mapOptions);
}
我得到这个错误无法设置属性'的位置'未定义。
这可能是什么问题?
and i get this error "Cannot set property 'position' of undefined". What might the problem be?
推荐答案
这个工程:
this works :
var mapElem = $("#container").find("#map")[0];
var map = new google.maps.Map(mapElem,mapOptions);
这篇关于Google地图请求返回“Can not set property'position of undefined”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文