infowindow behavior...

31 views
Skip to first unread message

felixweb

unread,
Oct 13, 2011, 9:58:40 AM10/13/11
to google-map...@googlegroups.com
Hello,

i'm trying to build a map for my website and i have a behavior i am not able to solve... I don't know if this is due to my limited knowledge of javascript or to my limited knowledge of Gmaps but...

http://www.felixweb.it/italia2011f.html

here is the map. The code should be downloadable... As you can see in the baloon i put the place and a number, the number should be proressive from the i variable, but i get the latest value in every baloon (the goal is to put the different dates in riga[2] in the infowindows...).

What am i doing wrong? :(

felixweb

unread,
Oct 14, 2011, 10:25:18 AM10/14/11
to google-map...@googlegroups.com
No help? I'm getting disperate!

geoco...@gmail.com

unread,
Oct 14, 2011, 11:21:32 AM10/14/11
to Google Maps JavaScript API v3
On Oct 14, 7:25 am, felixweb <mordo...@gmail.com> wrote:
> No help? I'm getting disperate!

your original message:
Seems to be working correctly to me (in Firefox on Linux).
Geocoding addresses of known points every time you load the map is bad
practice, you should geocode the points off-line and use the resulting
coordinates to place the markers.

-- Larry

Rossko

unread,
Oct 14, 2011, 11:36:07 AM10/14/11
to Google Maps JavaScript API v3
> http://www.felixweb.it/italia2011f.html

Your variable 'map' is undeclared, may give different results in
different browsers (doesn't work at all in IE for me)

Your code
geocoder.geocode( { 'address': luogo}, function(results, status) {
....
data = riga[2];
Your variable 'riga' is undeclared, different browsers etc. Some will
assume you meant a global variable.
The geocode() call just fires off a request, your loop rolls on and
replaces 'riga' with the values for the next marker, fires off another
request, etc.
At the end of the loop, 'riga' is left at the last set of values.
Sometime later, the results come back from Google and the callback
function runs, using riga[2] ... which will be that for the last
marker.

alexandroid

unread,
Oct 14, 2011, 5:16:06 PM10/14/11
to Google Maps JavaScript API v3
Well you are using riga[2] and its value is the same at the time when
all geocoder callbacks are called.

I think you may want to try to add "var" to riga declaration, i.e. var
riga = listah[i].split(';');

Use Firebug in Chrome or Firefox to set breakpoints in your javascript
and you would be able to see values during execution.

~Alex

On Oct 13, 6:58 am, felixweb <mordo...@gmail.com> wrote:

geoco...@gmail.com

unread,
Oct 14, 2011, 6:14:15 PM10/14/11
to Google Maps JavaScript API v3
On Oct 14, 8:21 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
Works for me in IE(8) also. I do get a javascript error (I don't
remember seeing it before):

Message: 'bounds' is undefined
Line: 63
Char: 2
Code: 0
URI: http://www.felixweb.it/italia2011f.html


  -- Larry
Reply all
Reply to author
Forward
0 new messages