downloadUrl("http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx.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 address = markers[i].getAttribute("address");
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"; x x x x x x x x
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);
}
}
答案 0 :(得分:1)
如果变量address
包含链接引用,则可以更改以下行
var html = "<b>" + name + "</b> <br/>" + "address";
到
var html = "<strong><a href='" + address + "'>" + name + "</a></strong>";
会产生类似
的东西<strong><a href='http://someLink'>Some name</a></strong>
因此,点击Some name
会指向href
属性中的链接。
或者我想要你这个
var html = "<strong>" + name + "</strong> <a href='" + address + "'>address</a>";