0

I tried with this

script here

var locationmap=10.521649, 76.215076";
var map;
    var geocoder; 
    function InitializeMap() {
        var input = document.getElementById('locationmap'),
        locationmap = input.value;
     alert("locationmap"+locationmap);
        var latlng = new google.maps.LatLng(locationmap);
        var myOptions =
        {
            zoom: 8,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            disableDefaultUI: true
        };
        map = new google.maps.Map(document.getElementById("map"), myOptions);
    }

    function FindLocaiton() {
        geocoder = new google.maps.Geocoder();
        InitializeMap();

        var address = document.getElementById("addressinput").value;
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });

            }
            else {
                alert("Geocode was not successful for the following reason: " + status);
            }
        });

    } 
 window.onload = InitializeMap; 

and html code is

<div id="wb_Text8" style="position:absolute;left:34px;top:518px;width:97px;height:16px;z-index:18;text-align:left;">
                    <span style="color:#000000;font-family:Arial;font-size:13px;">Location Map :</span>
                </div>
                <input type="text" th:field="*{location_Map}" id="locationmap" style="position:absolute;left:157px;top:511px;width:193px;height:23px;line-height:23px;z-index:20;" name="Editbox3" value="" />
                <div id="map" style="height: 253px">
                </div>

Here the webpage load first time shows correct map. But when i change the lat & lon inside the textbox the map is not chagne

If you know about this please share here..

Prasanth A R
  • 4,046
  • 9
  • 48
  • 76
  • How is `FindLocaiton()` called and why is there `InitializeMap()` inside it? – Anto Jurković Apr 22 '14 at 10:10
  • possible duplicate of [google maps move marker with lat/lng from ajax success returned data](http://stackoverflow.com/questions/17654989/google-maps-move-marker-with-lat-lng-from-ajax-success-returned-data) – geocodezip Apr 22 '14 at 13:42

0 Answers0