开发者

adding more data to info window

开发者 https://www.devze.com 2023-03-09 08:18 出处:网络
In my web app, the data comes from the responseXML property.When I click a marker on a google map, it shows the address of the market in the information window. I also want to show the value of openho

In my web app, the data comes from the responseXML property. When I click a marker on a google map, it shows the address of the market in the information window. I also want to show the value of openhours in the info window. How would I do that?

Here is my code so far:

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);
        }
    }
}


You could do it by changing this:

        map.openInfoWindowHtml(point, address);

To this:

        map.openInfoWindowHtml(point, address + '<br/>' + openhours);
0

精彩评论

暂无评论...
验证码 换一张
取 消