我开发了一个 Google map 页面,它在我告诉它的地方显示一个标记。如果您单击营销人员,则会弹出信息窗口。但是,我想知道是否有人知道如何打开信息窗口并同时显示标记? (如 onload)
这是页面:http://www.sportingemporium.com/map_test3.htm
这似乎是一个简单的练习,但我已经搜索了几个小时但没有找到解决方案!
任何帮助都会很棒!
最佳答案
您只需调用 marker.openInfoWindowHtml()
即可强制打开信息窗口:
var map = new GMap2(document.getElementById("map"));
var point = new GLatLng(53.3407791, -6.2596385);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(point, 16);
// Set up three markers with info windows
var html = 'South Anne Street,<br />Dublin 2, Ireland';
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(html); // This opens the info window automatically
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
openInfoWindowHtml http://img534.imageshack.us/img534/1273/autoinfo.png
关于javascript - 在 Google map 中与标记同时显示信息窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2784833/