嗨,我正在尝试将 gmap 与我的网站集成。但默认情况下,信息窗口是打开的。我想在单击标记后打开信息窗口。如何在页面加载时关闭信息窗口?
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(22.4642600, 70.0690540), 6);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addMapType(G_SATELLITE_3D_MAP);
for (var i = 0; i < newpoints.length; i++) {
var point = new GPoint(newpoints[i][1], newpoints[i][0]);
var popuphtml = newpoints[i][4];
var post_url = newpoints[i][5];
var addr = newpoints[i][6];
var marker = createMarker(point, newpoints[i][2], popuphtml, post_url, addr);
map.addOverlay(marker);
}
}
}
function createMarker(point, icon, popuphtml, post_url, addr) {
var popuphtml = '<div id="popup">' + popuphtml + '<div><a href=' + post_url + '>Link</a></div></div>';
var marker = new GMarker(point);
marker.openInfoWindowHtml(popuphtml);
GEvent.addListener(marker, "click", function () {
marker.openInfoWindowHtml(popuphtml);
});
return marker;
}