1
我試圖改變顏色爲一個Gpolygon用鼠標懸停事件改變顏色的Gpolygon用鼠標事件
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(-39.875696,-72.624207), 9);
pLat = 0.2;
pLon = 0.2;
p1Lat = -40;
p1Lon = -73;
p1Coor = [
new GLatLng(p1Lat, p1Lon - pLon),
new GLatLng(p1Lat + pLat, p1Lon),
new GLatLng(p1Lat, p1Lon + pLon),
new GLatLng(p1Lat - pLat, p1Lon),
new GLatLng(p1Lat, p1Lon - pLon)
];
var p1 = new GPolygon(p1Coor, "#f33f00", 2, 1, "#ff0000", 0.2);
GEvent.addListener(p1,"mouseover",function(overlay,latlng){
p1.color = "#ffff00";
alert(p1.color);
});
map.addOverlay(p1);
屬性的變化,但我不`噸看到的變化。爲什麼?