0

源代码中有一个添加 Maker 功能。
我怎样才能访问它?
另外,如何更改图标并将 infoBox 添加到标记?

this.addMarker = function (lat, lng, icon, infoWindowContent, label, url, thumbnail)
4

1 回答 1

0

Javascript 是一种灵活的语言。您可以将代码编写为:

var marker = new google.maps.Marker({ position: latLng, clickable: true, icon: markerJSON[i].icon, myExtraEntity1: markerJSON[i].oldLatLng, myExtraEntity2: markerJSON[i].headshipID});
marker.myExtraEntity3 = markerJSON[i].id;
marker.map=mymap;

var content= "Tool: " + markerJSON[i].toolName+ " <br><br>Gang: " + markerJSON[i].gangName + "<br><br>Gang Cheff: " +
                             markerJSON[i].cheff+ "<br><br><a href='javascript:drawPath(" + marker.id + ")'>[1 Day Path]</a><a href='javascript:cleanPath(" + marker.id + ")'>[Clean Path]</a>"

var boxText = document.createElement("div");
boxText.className = "infoBox";
boxText.innerHTML = content;



marker.info = new google.maps.InfoWindow({
                    content: boxText
                });

addInfoWindow(marker, marker.info.content);
markers.push(marker);
于 2013-08-18T08:17:06.657 回答