Firstly, you should of read this: http://groups.google.com/group/Google-Maps-API/web/suggested-posting-guidelines?hl=en
A few points to pickup on, Firefox picks up a few obvious javascript errors, suggest you try debugging in that. Also you load mgeorss which is designed for version 1of the maps API by the looks of it, when loading the standalone API you it does load some basic compatibility stuff, but not via the common loader (which you are using). for the actual issue I recommend reading: http://econym.org.uk/gmap/scope.htm On Fri, Oct 3, 2008 at 10:51 PM, Various Elmts <[EMAIL PROTECTED]> wrote: > > 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] > > <script type="text/javascript"> > > 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); > > </script> > > [/code] > > > > -- Barry - www.nearby.org.uk - www.geograph.org.uk - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
