Hi all!

I have a map canvas, the map's center is displayed below it, and every
time the user drags it the value is updated. It works perfectly if I
use a <span> container to display it, but what I really want is an
<input> field. I can't get the value to update in the input field, it
stays at the initial value. Any suggestions? Thanks! :)
Here's my code:

  function initialize() {
    var myLatlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 8,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);

        google.maps.event.addListener(map, 'dragend', function() {
     mapCenter = map.getCenter();
     document.getElementById("mcenter").innerHTML = mapCenter;   });

         document.getElementById("mcenter").innerHTML = myOptions.center;
         document.getElementById("test").value = myOptions.center;

  }

... and in the body:

This updates: <span id="mcenter"></span><br/>
This does not update: <input type="text" name="name" id="test"
value="">

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to