如何在谷歌地图中显示标记的信息?

时间:2013-04-26 13:50:29

标签: javascript jquery html eclipse google-maps

如何显示特定制造商的信息?如地点名称,地址,电话等 我使用eclipse和库phonegap,在我的项目中我使用代码html和jquery。 多个制造商的脚本是这样的:

var ltlng = [];

        ltlng.push(new google.maps.LatLng(44.342377, 9.229788));
        ltlng.push(new google.maps.LatLng(13.5, 79.2));
        ltlng.push(new google.maps.LatLng(15.24, 77.16));

        map.setCenter(ltlng[0]);
        for (var i = 0; i <= ltlng.length; i++) {
            marker = new google.maps.Marker({
                map: map,
                position: ltlng[i]
            });

            (function (i, marker) {



                google.maps.event.addListener(marker, 'click', function () {

                    if (!infowindow) {
                        infowindow = new google.maps.InfoWindow({ content: 'Location info:<br/>Country Name:<br/>LatLng:');
                    };

                    infowindow.setContent("Message" + i);

                    infowindow.open(map, marker);

                });

})(i, marker);
};

1 个答案:

答案 0 :(得分:0)

如果您在用户点击地图标记时提到信息图标,则以下内容可解决您的问题:

Adding multiple markers with infowindows (Google Maps API)

相关问题