Dear Group, I am totally lost, I almost read every related thread in this group but my script stil doesn't work.
I create a marker by clicking one the map, a info window pops up and inside is a link that allows you to remove the marker again. I tried everything, but the script don't work. Online example is at http://www.variouselmts.com/happytrees/ Code: [code] var markers = new Array(); var counter = 0; google.load("maps", "2"); // Call this function when the page has been loaded function initialize() { var map = new google.maps.Map2(document.getElementById("map")); map.addControl(new GMapTypeControl()); map.addControl(new GLargeMapControl()); map.setCenter(new google.maps.LatLng(40.717079, -73.98571), 12); map.setMapType(G_SATELLITE_MAP); map.enableScrollWheelZoom(); GEvent.addListener(map, "click", function(overlay, latlng) { counter++; var marker = new GMarker(latlng, {title: counter, draggable: true}); markers[counter] = marker; var markerbox = "<div class=\"marker-box\">"; markerbox += "<h2>" + marker.getTitle() + "</h2>"; markerbox += "<span>Drag marker to the position where you have plant a \"Happy Tree\" and <input type=\"submit\" value=\"save\"> it, forever!</span>"; markerbox += "<form action=\"backend/save.php\" method= \"post\" accept-charset=\"utf-8\">"; markerbox += "<input type=\"hidden\" name=\"lat\" value= \"GLatLng.lat() \">"; markerbox += "<input type=\"hidden\" name=\"lng\" value= \"GLatLng.lng() \">"; markerbox += ""; markerbox += "<a href= \"javascript:map.removeOverlay(markers[" + marker.getTitle() + "]) \">Remove This Marker</a>"; markerbox += "</form>"; markerbox += "</div>"; GEvent.addListener(marker, "dragstart", function() { map.closeInfoWindow(); }); GEvent.addListener(marker, "dragend", function(point) { marker.openInfoWindowHtml(markerbox); }); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(markerbox); }); map.addOverlay(marker); marker.openInfoWindowHtml(markerbox); }); }; google.setOnLoadCallback(initialize); [/code] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
