嗨,我在下面有一个多边形:
var polygon = new google.maps.Polygon({
paths: coords,
id : 123,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 1,
fillColor: '#FF0000',
fillOpacity: 0.35
});
polygon.setMap(globalMap);
我给它附加了一个id属性,所以我以后可以参考它,问题是。如何找到相同的多边形并触发事件?比如改变颜色之类的?
function changePolygonColor(){
//refer to the polygon with id 123 (this is my question)
//change its color
polygon.fillColor = '#00FF00';
}
非常感谢!