> http://nchrp923b.lab.asu.edu/index.html
You cannot sensibly define a series of functions with the same name
function addState(Alabama) { ...
function addState(Alaska) { ...
...
function addState(WestVirginia) { ...
It's not a maps thing, it's basic javascript. Only one function is
allowed with the name addState(), else how would the browser know
which one to run?
What happens is that each new definition overwrites the previous one.
In the end, only the function you define beginning
function addState(WestVirginia) { ...
is valid.
It is basic principle of javascript that the arguments to a function
may be substituted. If I write code
var banana = "skin";
addState(banana);
it will call the function addState() with the value of the first
argument as the string "skin".
If I had defined the function as
function addState(WestVirginia) {
alert (WestVirginia) ;
}
see if you can work out what will be alerted.
You already have code that finds out which dropdown selection was
made, and passes it to addState().
Now you need to write just _one_ function like
function addState(selectedState) { ...
that examines the value of 'selectedState' and does appropriate things
with it.
It's unwise to create new maps in every function you have. Just make
one in your initialize() function and re-use it.
--
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.