0

我创建了一个切换来清除所有标记的地图。单击切换时,它会调用 getMapVisit()

单击 mapList 时出现此错误:

未捕获的 ReferenceError:未定义标记

我的源代码在这里

我如何修复我的源代码和谷歌 API

谢谢

4

1 回答 1

1

I ran your code and the error shows 'marker is not defined'. This error is because the variable has not been declared or initialized before you use it in the following code :

if(marker){                                   
    marker.setMap(null);
}

You need to declare the marker variable at the start of your code.

var map;
var marker;

The code works after this. Let me know if this works.

于 2013-07-23T05:29:29.270 回答