I\'m trying to build an interactive map using google\'s map api v3. The idea is to populate a list of markers on the map with some text using asp.
Creating the map,
You need to store your markers in an array that can be used later. Right now the code
markerID = this.id;
Is just going to be set to "marker1", it isn't actually the marker object. You need to create a collection of markers:
var markers = new Array();
After you create a marker you need to store it in the array:
markers.push(marker);
When your element receives a click event you need to retrieve the marker from the array of markers:
marker = markers[this.id];
Here is a working example:
-
Salt Lake City
Capital of Utah
40.763901
-111.901245
-
Provo
Location of BYU
40.25228
-111.659546