Hey guys,

I really don't know what am I dowing wrong.
Below is my script with the function loadGoogleMap called when someone
is entering a city in a html input field.
I want the Google Map loaded not beforehand, but after he's entering a
city.

The problem is, that everything works like a charm, the map is there,
the center of the map is correct, but the marker isn't draggable.

Any suggestions?

Thank you very much.



function loadGoogleMap()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://www.google.com/jsapi?&key=<?php echo
GOOGLE_MAPS_API_KEY; ?>&callback=loadMaps";
document.getElementsByTagName("head")[0].appendChild(script);
}

function loadMaps()
{
google.load("maps", "2.x", {"base_domain" : "maps.google.de",
"callback" : initialize});
}

function initialize()
{

if (GBrowserIsCompatible())
{
        mapLayer = new google.maps.Map2(document.getElementById
("map_canvas"));
        mapLayer.setMapType(G_NORMAL_MAP);

        mapControlLayer = new google.maps.MapTypeControl();
        mapLayer.addControl(mapControlLayer);
        mapLayer.addControl(new google.maps.SmallMapControl());

        mapLayer.setCenter(new google.maps.LatLng('<?php echo $ygeo; ?>', '<?
php echo $xgeo; ?>'), <?php echo $zoom; ?>);

        baseIconLayer = new google.maps.Icon(G_DEFAULT_ICON);
        markerOptionsLayer = { icon: baseIconLayer, draggable : true };

        markerLayer = new google.maps.Marker(mapLayer.getCenter(),
markerOptionsLayer);

        geocoderLayer = new google.maps.ClientGeocoder();

        google.maps.Event.addListener(markerLayer, "dragend",function
(koordinatenLayer)
{
        var arrKoordinatenLng = koordinatenLayer.lng();
        var arrKoordinatenLat = koordinatenLayer.lat();

        geocoderLayer.getLocations(markerLayer.getLatLng(), function
(response)
        {
                placeLayerRegistrieren = response.Placemark[0];
                var arrPlace = placeLayerRegistrieren.address.split(", ");
                ...

        });

});

mapLayer.addOverlay(markerLayer);

}
}

--

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