谷歌地图信息窗口数据显示

时间:2013-02-07 08:21:46

标签: infowindow

我有关于信息窗口数据的错误。我无法得到请帮我查一下我的代码。

function initialize() {

    map = new google.maps.Map(document.getElementById(map), {
    center: new google.maps.LatLng(1.352083, 103.819836),
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP

    });

      //var infowindow;
      if (markers) {

        for (var level in markers) {
          for (var i = 0; i < markers[level].length; i++) {
            var details = markers[level][i];
                //var infowindow;
                  markers[level][i] = new google.maps.Marker({
                  title: details.name,
                  position: new google.maps.LatLng(
                  details.location[0], details.location[1]),
                  clickable: true,
                  draggable: false,
                  icon: details.icon
                });
                var infowindow = new google.maps.InfoWindow({
                    content: details.description,
                    //content : markers[level][i].description,
                    position: new google.maps.LatLng(details.location[0], details.location[1])
                    //position: markers[level][i].position
                });
            google.maps.event.addListener(markers[level][i], 'click', function() {
                infowindow.setPosition(this.position);
                alert(this.position);
                //infowindow.setContent(markers[level][i].description);
                infowindow.open(map,markers[level][i]);
            });
         }
        }
      }

我无法获取描述数据。请帮我查一下我的代码。

0 个答案:

没有答案