Hi,
I have a marker on a map, which the user can drag it. I want to get
the co-ordinates on the marker when the user hits a save button, how
can i do this?
here is my current code.
<script type="text/javascript">
////map
var map = new GMap2(document.getElementById("map"));
//var start = new GLatLng(65,25);
map.setCenter(new GLatLng(<? echo $lat; ?>,<? echo $long; ?>), 14);
map.addControl(new GMapTypeControl(1));
map.addControl(new GLargeMapControl());
map.enableContinuousZoom();
map.enableDoubleClickZoom();
// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/
mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
/////Draggable markers
var point = new GLatLng(<? echo $lat; ?>,<? echo $long; ?>);
var markerD2 = new GMarker(point, {icon:G_DEFAULT_ICON, draggable:
true});
map.addOverlay(markerD2);
markerD2.enableDragging();
GEvent.addListener(markerD2, "drag", function(){
document.getElementById("location").value=markerD2.getPoint
().toUrlValue();
});
GEvent.addListener(map, "mousemove", function(point){
document.getElementById("mouse").value=point.toUrlValue();
});
//]]>
</script>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---