【发布时间】:2014-03-18 19:58:21
【问题描述】:
我在使用 Google Maps API 时遇到了问题。 Google 向我返回错误:未捕获的 TypeError:无法调用未定义的方法“getPosition”。在这段代码中:
function center_map(current) {
var default_image_path = js_load_parameters.theme_default_path;
map.setCenter(markers[current].getPosition());
for(i = 0; i < quantity; i++) {
markers[i].setIcon(default_image_path+'/layout/images/marker_map_1.png');
}
markers[current].setIcon(default_image_path+'/layout/images/marker_map_1_act.png');
current_location = current;
}
【问题讨论】:
-
嗯,当然,这表明markers[current] 正在评估为未定义。现在,这是您的代码还是 API 库的一部分?
-
电流值是多少?标记[当前] 是否存在?
标签: javascript api google-maps maps