For the second question I found a solution: I simply add
map.setCenter(results[0].geometry.location) in searchAddress()
function and it seems works.
So, it reamains the problem to delete the others markers...

On 18 Mar, 02:25, thebit <[email protected]> wrote:
> Hello and thank you for your answer.
> I'm sorry but I do not know how to do realise that your told.
> I tried to declare a Marker global variable but I don't know how to do
> delete each previous Marker created when a new Marker is creates.
>
> 2) The "searchAddress()" function is:
> ***********
>                         function searchAddress()
>
>                         {
>
>                                 var address = 
> document.getElementById("address").value;
>
>                                 var geocoder = new google.maps.Geocoder();
>
>                                 geocoder.geocode( {'address': address}, 
> function(results,status)
>
>                                 {
>
>                                         if(status == 
> google.maps.GeocoderStatus.OK)
>
>                                         {
>
>                                                 var options =
>
>                                                 {
>
>                                                         zoom: 14,
>
>                                                         center: 
> results[0].geometry.location,
>
>                                                         mapTypeId: 
> google.maps.MapTypeId.ROADMAP
>
>                                                 };
>
>                                                 //var map = new
> google.maps.Map(document.getElementById('mappa'), options);
>                                                 map = new 
> google.maps.Map(document.getElementById('mappa'),
> options);
>
>                                         }
> *****
> I utilised the mab global variable but the problem is the same and if
> I do not declare a new map, the search address does not return any
> address.
> Please, can you help me?
>
> Thank you in advance.
>
> On 17 Mar, 20:42, Rossko <[email protected]> wrote:
>
> > > You can view it at the following 
> > > link:http://thebit.altervista.org/maps/testAddMarker3.php
> > > The problem is that after to have searched an address it is not
> > > possible to add a Marker. Why?
>
> > For some reason, you have chosen to create a new 'map' object local to
> > your searchAddress() function.  You already made a perfectly good
> > 'map' in your initialize() function, duplicating just confuses things.
>
> > > I have also 2 little questions and I hope to find solution:
> > > 1) how I should to do to submit the form (look the previous link) by
> > > using AJAX or without to open other pages?
>
> > What previous link?
> > Using forms with AJAX is not a particular maps 
> > issuehttp://www.google.com/search?q=javascript+forms+ajax
>
> > > 2) I know it exists a way to delete each marker by creating another
> > > one.
> > > E.g if you try to add a marker you can add many marker without saving
> > > its. I would like know how to do do delete each marker not saved whene
> > > someone try to add a new marker.
>
> > Make your script so that it only creates one marker.  One way to do
> > that is to create one marker in global scope, and to move it around
> > when "adding"

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