I know I should not paste code, but you can not see it because of the
way my map works.  Let me know how to recycle the existing marker
instead of adding a new one each click.  Thanks Again

GEvent.addListener(map, "click", function(overlay, latlng) {
          if (latlng) {

          marker = new GMarker(latlng, {draggable:true});

            GEvent.addListener(marker, "click", function() {
              var html = "<table>" +
                                                        "<tr><td></td> 
<td><input type='hidden' value='<?php echo
$lastid ?>' id='lakeid'/> </td> </tr>" +
                         "<tr><td>Name:</td> <td><input type='fixed'
value='<?php echo $lakename ?>' id='name'/> </td> </tr>" +
                         "<tr><td>Address:</td> <td><input type='text'
id='address'/></td> </tr>" +
                         "<tr><td>Type:</td> <td><select id='type'>" +
                         "<option value='bar' SELECTED>bar</option>" +
                         "<option value='restaurant'>restaurant</
option>" +
                         "</select> </td></tr>" +
                         "<tr><td></td><td><input type='button'
value='Save & Close' onclick='saveData()'/></td></tr>";

              marker.openInfoWindow(html);
            });
            map.addOverlay(marker);
          }
        });

      }
     }


         function saveData() {
                var id = escape(document.getElementById("lakeid").value);
      var name = escape(document.getElementById("name").value);
      var address = escape(document.getElementById("address").value);
      var type = document.getElementById("type").value;
      var latlng = marker.getLatLng();
      var lat = latlng.lat();
      var lng = latlng.lng();

      var url = "phpsqlinfo_addrow.php?id=" + id + "&name=" + name +
"&address=" + address +
                "&type=" + type + "&lat=" + lat + "&lng=" + lng;
      GDownloadUrl(url, function(data, responseCode) {
        if (responseCode == 200 && data.length <= 1) {
          marker.closeInfoWindow();
          document.getElementById("message").innerHTML = "Location
added.";
        }
      });
    }


On Aug 28, 12:12 am, Adam Kestel <[email protected]> wrote:
> How would I work that into my code?
>
> On Aug 27, 1:25 pm, Esa <[email protected]> wrote:
>
> > Instead of creating a new marker each time, you can recycle a single
> > marker by moving it to the clicked point.
>
> >    marker.setLatLng(clickPoint);
>
> > If the marker is draggable, it gives even better user interface. The
> > initial location of the marker can be for instance South Pole.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to