Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript List + google maps = headache Re: List + google maps = headache

#56685
kevsyers
Participant

Yeah that makes sense. The empty list is populated by the javascript (the random points). And the markers are appended to the list. (Not trying to repeat what you said, just making sure I understand it)

This is the code that I have for my points on the map:

Code:
function addPoints() {

newpoints[0] = new Array(35.600168, -77.334524, icon0, ‘GK Café’, ‘Two sisters have opened a cafe and catering company, GK Café & Catering, bearing their initials and featuring some of the Southern food they grew up eating at home.’);
newpoints[1] = new Array(35.57771, -77.381184, icon0, ‘Salsarita's Fresh Cantina’, ‘A Salsarita's Fresh Cantina is slated to open soon in this location.’);
newpoints[2] = new Array(35.609966, -77.401196, icon0, ‘Jimmy John's’, ‘Jimmy John's is known for its “freaky fast,” fresh subs, which local owner Pete Triebenbacher’);

for(var i = 0; i < newpoints.length; i++) { var point = new GPoint(newpoints[i][1],newpoints[i][0]); var popuphtml = newpoints[i][4] ; var marker = createMarker(point,newpoints[i][2],popuphtml); map.addOverlay(marker); } } function createMarker(point, icon, popuphtml) { var popuphtml = "

“;
var marker = new GMarker(point, icon);
GEvent.addListener(marker, “click”, function() {
marker.openInfoWindowHtml(popuphtml);
});
return marker;
}

This is my code for my list:

Code:
  • GK Cafe
  • Salsarita
  • Jimmy John’s

Is it possible for me to give the list items an id and append each ‘newpoints’ to it. Or am I way off base?