且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何修改标记?

更新时间:2023-12-05 20:35:40

您可以创建1个数组)
或设置验证
的默认值并尝试以下代码:

you can create 1 array of type (restaurants,hotels) or set default value of validate and try this code:

var url = "";
if(a == "hotels"){
   url = "http://exampl.com/yellow.png";   
}else{
   url = "http://exampl.com/green.png"
}
marker_new[i] = google.maps.Marker({
                                 icon: _url;
                                 position: place.geometry.location,
                                 map: map
                               });

加到这里

function showSelectedPlace() {
    clearResults();
    clearMarkers();
    var place = autocomplete.getPlace();
    map.panTo(place.geometry.location);
    markers[0] = new google.maps.Marker({
      position: place.geometry.location,
      map: map
    });
    iw = new google.maps.InfoWindow({
      content: getIWContent(place)
    });
    iw.open(map, markers[0]);
  }

这里

 places.search(search, function(results, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
       clearResults();
       clearMarkers();
        for (var i = 0; i < results.length; i++) {
          markers[i] = new google.maps.Marker({
            position: results[i].geometry.location,
            animation: google.maps.Animation.DROP
          });
          google.maps.event.addListener(markers[i], 'click', getDetails(results[i], i));
          setTimeout(dropMarker(i), i * 100);
          addResult(results[i], i);
        }
      }