Hi all,
I'm a 100% newbie when it comes to javascript, so I need some help
with something. I'm sure that I could find the solution to this in
time, but I don't know what search terms to use, so that's why I'm
asking here.
This is my problem. I have a page with a Gmap in the middle. I want to
be able to call the gmap script in a seperate .js file so as to reduce
to size of the html file, and to allow caching of the file, as well as
to facilitate editing. Here is the page I'm working on:
http://mexicometro.org/en/line3/indios_verdes_gmap.html
I will have many pages like this, each with a different
"map.setCenter", but I want them all to have the same icons and
polylines (there will be many more icons and polylines, I just haven't
programmed them yet). It seems to me that I should be able to call 2
different js files in the html; one listing all the icons and
polylines, (so that the visitor to the site will only have to download
it once and I only have to edit one, instead of a couple of hundred
different one), and one which will only set the new mapcenter. Is this
possible? When I tried it, it seems that they cancel each other out,
and I get an empty Gmaps frame, with no satelite images or anything.
One possible solution that I figured was that I could have the html
call one js file, which would set the mapcenter, and THAT js would
call the other one, with all the coordinates, etc. Can I do that? If
so, how?
I hope my question is clear enough. Please let me know if I need to
explain a bit clearer. Thank you! |