The main problem is that you changed the code to use a .html property of a marker (google.maps.Marker objects don't have a .html properties, but you can add them).
2 options for fixing it:
Use your original code:
// A function to create the marker and set up the event window function function createMarker(latlng, name, html) { var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, zIndex: Math.round(latlng.lat() * -100000) << 5 }); google.maps.event.addListener(marker, 'click', function () { infowindow.setContent(contentString); infowindow.open(map,marker); map.setZoom(10); map.setCenter(marker.getPosition()); }); // save the info we need to use later for the side_bar gmarkers.push(marker); // add a line to the side_bar html side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length - 1) + ')">' + name + '<\/a><br>'; }
Add .html to the google.maps.Marker and use
this
:// A function to create the marker and set up the event window function function createMarker(latlng, name, html) { var marker = new google.maps.Marker({ position: latlng, map: map, html: html, // <---------------------------------------------- add this to the Marker zIndex: Math.round(latlng.lat() * -100000) << 5 }); google.maps.event.addListener(marker, 'click', function () { infowindow.setContent(this.html); infowindow.open(map,this); map.setZoom(10); map.setCenter(this.getPosition()); }); // save the info we need to use later for the side_bar gmarkers.push(marker); // add a line to the side_bar html side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length - 1) + ')">' + name + '<\/a><br>'; }