我按照google API网站上的说明构建了google地图。
该地图正确显示了引脚,但是信息窗口显示了我为每个标记创建的链接的html,而不是链接。
有人可以告诉我我做错了什么吗?
这是xml中标记的示例:
<marker id="1" name="&lt;a target=&quot;_blank&quot; href=&quot;https://www.google.com/maps/place/123+N+Main+St,+Shelby,+NC+28152/@35.2519982,-81.6692009,17z/data=!3m1!4b1!4m5!3m4!1s0x88571840d0638f6b:0x66ad879686bcd63f!8m2!3d35.2519982!4d-81.6670069&quot;&gt;Click here directions &lt;/a&gt;" address="123 North Main St, Shelby NC 28152" lat="35.2519982" lng="-81.6692009" type="circlek" info="<a target="_blank" href="https://www.google.com/maps/place/123+N+Main+St,+Shelby,+NC+28152/@35.2519982,-81.6692009,17z/data=!3m1!4b1!4m5!3m4!1s0x88571840d0638f6b:0x66ad879686bcd63f!8m2!3d35.2519982!4d-81.6670069">Click here directions </a>" />
这是我在地图脚本中的代码:
Array.prototype.forEach.call(markers, function(markerElem) {
var id = markerElem.getAttribute('id');
var name = markerElem.getAttribute('name');
var address = markerElem.getAttribute('address');
var type = markerElem.getAttribute('type');
var info = markerElem.getAttribute('info');
var point = new google.maps.LatLng(
parseFloat(markerElem.getAttribute('lat')),
parseFloat(markerElem.getAttribute('lng')));
var infowincontent = document.createElement('div');
var strong = document.createElement('strong');
strong.textContent = info
infowincontent.appendChild(strong);
infowincontent.appendChild(document.createElement('br'));
var text = document.createElement('text');
text.textContent = address
infowincontent.appendChild(text);
var icon = customLabel[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
label: icon.label
});