向信息窗口添加更多数据

问题描述

| 在我的Web应用程序中,数据来自
responseXML
属性。当我单击Google地图上的标记时,它会在信息窗口中显示市场的地址。我也想在信息窗口中显示
openhours
的值。我该怎么做? 到目前为止,这是我的代码
function display() {
    if ((xhr.readyState == 4) && (xhr.status == 200)) {
        var xmlDoc = xhr.responseXML;
        var market = xmlDoc.documentElement.getElementsByTagName(\"market\");
        for (var i = 0; i < market.length; i++) {
            var address = market[i].getElementsByTagName(\"address\");
            address = address[0].childNodes[0].nodeValue;
            var openhours = market[i].getElementsByTagName(\"openhours\");
            openhours = openhours[0].childNodes[0].nodeValue;
            geocoder.getLocations(address,addToMap);
        }
    }
}
    

解决方法

        您可以通过更改此方法来做到这一点:
        map.openInfoWindowHtml(point,address);
对此:
        map.openInfoWindowHtml(point,address + \'<br/>\' + openhours);