我的交互式地图使用xml从数据库加载窗口信息的信息。 在这种情况下,您知道如何在infowindow上添加照片和按钮或任何其他功能吗?
这是我的代码
function load() {
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(31.7031, 35.1956),
zoom: 17,
mapTypeId: 'roadmap'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl("map_xml.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var email = markers[i].getAttribute("email");
var address = markers[i].getAttribute("address");
var phone = markers[i].getAttribute("phone");
var type = markers[i].getAttribute("type");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "<b>" + name + "</b> <br/>" + address + "</b> <br/>" + email + "</b> <br/>" + phone + "</b> <br/>";
var icon = customIcons[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
}
我希望它看起来像这个更加发达
http://maps.marnoto.com/en/5wayscustomizeinfowindow/example.html + 按钮
但是我仍然需要将信息从XML连接导入数据库,就像我正在做的那样