Hey, I figured it out... I had to change pretty much the whole
process...

<script type="text/javascript">
var map;
var n=0;
function init() {
  var latLng = new
google.maps.LatLng(20.704959215396133,-103.32770333862305);
  var myOptions = {
    zoom: 18,
    center: latLng,
        disableDefaultUI: true,
        keyboardShortcuts: false,
        scaleControl: false,
        scrollwheel: false,
        disableDoubleClickZoom: true,
        draggableCursor: 'crosshair',
        draggingCursor: 'crosshair',
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
  var latLngBounds = new google.maps.LatLngBounds(latLng);
  google.maps.event.addListener(map, 'click', function(event) {
    var marker = new google.maps.Marker({
      map: map,
      position: event.latLng,
      title: 'Marker ' + n
    });
        latLngBounds.extend(latLng);
        document.getElementById("frmLat").value = event.latLng.lat();
    document.getElementById("frmLon").value = event.latLng.lng();
        google.maps.event.addListener(marker, 'click', (function(markerArg,
index) {
      return function() {
                var aux = markerArg.getPosition().toString();
                var cad = aux.split(',');
                var lat = cad[0].replace('(','');
                var lng = cad[1].replace(')','');
                document.getElementById("lastLat").value = lat;
                document.getElementById("lastLon").value = lng;
      };
    })(marker, n));
        n++;
  });
}
google.maps.event.addDomListener(window, 'load', init);
</script>
</head>

-- 
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