hi. so ive got a map that plots points on it and i just wanted to add
function to show a speech bubble with some info based on a marker the
user clicks.

so i got the bubble to appear...but i cant get the bubble to display
the correct post code because its placed inside a function and the
array is created outside the function. but i cant see a solution for
re-arranging things.

here is my code for geocoding the postcodes. you should see the
problem with why it wont display the correct info in the bubble.


        function codeAddress() {
    var address = document.getElementById("address").innerHTML + " uk"
                address = address.substring(0, address.length-1);
                var myArray
                myArray = address.split(",")
                for ( i = 0; i < myArray.length; ++i )          {
                        geocoder.geocode( { 'address': myArray[i]},
                                function(results, status) {
                                        if (status == 
google.maps.GeocoderStatus.OK) {
                                                        for ( r = 0; r < 
results.length; r++ )   {
                                                                        var 
contentString = '<div id="content">'+
                                                                                
        '<div id="staffInfo">'+
                                                                                
        '</div>'+
                                                                                
        '<h1>' + myArray[i] + '</h1>'+
                                                                                
        '</div>';

                        var infowindow = new google.maps.InfoWindow({
                        content: contentString
                        });
                        var marker = new google.maps.Marker
                        (

                                { map: map,
                                        position: results[r].geometry.location,
                                }
                 );
                                google.maps.event.addListener(marker, 'click', 
function() {
                                infowindow.open(map,marker);
                        })

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

any help would be greatly appreciated...and any code would be
better :) thanks in advance

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