0

我有这个脚本用于来自谷歌地图标记的链接:

<script type="text/javascript">

  var locations = [['Test 1','55','13','url1'],['Test 2','45','17','url2']];

  function initialize()
    {
    var myOptions = {
        center: new google.maps.LatLng(50,15),
        zoom: 3,
        mapTypeId: google.maps.MapTypeId.SATELLITE};

    var map = new google.maps.Map(document.getElementById("map"),myOptions);

    setMarkers(map,locations)
    }

  function setMarkers(map,locations)
    {
    var marker, i

    for(i = 0; i < locations.length; i++)
      {
      var arr = i
      var name = locations[i][0]
      var lat = locations[i][1]
      var long = locations[i][2]
      var adress = locations[i][3]

      latlngset = new google.maps.LatLng(lat, long);

      var marker = new google.maps.Marker({
            map: map,
            title: name,
            url: adress,
            position: latlngset  
          });

      google.maps.event.addListener(marker, 'click', function() {window.location.href = this.url;});
      }
    }

  google.maps.event.addDomListener(window, 'load', initialize);

  </script>

...而且,我需要从标记而不是链接生成信息窗口,你有什么简单的想法吗?

来自标记的谷歌地图可点击信息窗口

4

0 回答 0