据我所知,此代码很好,应该显示一些带弹出HTML窗口的自定义图标。但弹出窗口不起作用!谁能指出我做错了什么?我似乎无法自己调试它。
谢谢!
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(51.410416, -0.293884), 15);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var i_parking = new GIcon();
i_parking.image = "http://google-maps-icons.googlecode.com/files/parking.png";
i_parking.iconSize = new GSize(32, 37);
i_parking.iconAnchor = new GPoint(16, 37);
icon_parking = { icon:i_parking };
var marker_office = new GMarker(new GLatLng(51.410416,-0.293884));
var marker_parking1 = new GMarker((new GLatLng(51.410178,-0.292000)),icon_parking);
var marker_parking2 = new GMarker((new GLatLng(51.410152,-0.298948)),icon_parking);
GEvent.addListener(marker_parking1, 'click', function() {
marker_parking1.openInfoWindowHtml('<strong>On Street Parking</strong><br>Church Road - 40p per hour');
});
GEvent.addListener(marker_parking2, 'click', function() {
marker_parking2.openInfoWindowHtml('<strong>Multi Storey - Fairfield</strong><br>Upper Car Park - 90p per half hour<br>Lower Car Park - £1.20 per hour');
});
map.addOverlay(marker_office);
map.addOverlay(marker_parking1);
map.addOverlay(marker_parking2);
}
}