Hi, I think I know, what you are trying to do. Try this:
var map1 = new GMap2(document.getElementById("map_canvas1"));
map1.addControl(new GSmallMapControl());
map1.addControl(new GMapTypeControl());
map1.setCenter(new GLatLng(50.028137, 15.200568),
7);
var marker1 = new GMarker(new GLatLng(50.028137, 15.200568),
{draggable: true});
GEvent.addListener(map1,"click", function(overlay,latlng) {
marker1.setLatLng(latlng);
document.getElementById("N").value = latlng.lat();
document.getElementById("E").value = latlng.lng();
});
map1.addOverlay(marker1);
GEvent.addListener(marker1, "dragend", function() {
var latlng = marker1.getLatLng();
document.getElementById("N").value = latlng.lat();
document.getElementById("E").value = latlng.lng();
});
}
}
On Jul 9, 12:22 pm, Rossko <[email protected]> wrote:
> > map.addOverlay(new GMarker(point, {draggable: true}));
>
> You can't attach anything to that newly-created marker, because you
> have no reference to get a hold of it.
>
> var somemarker = new GMarker(point, {draggable: true});
> map.addOverlay(somemarker);
> and whatever else you would like to do to that marker, for instance
> add a listener
> GEvent.addListener(somemarker, ....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---