Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Problem to show info window on clicking of every marker in gmap display only markers but not show info window..

var map;
var cPoly = null;
var cPolyM = null;
var cPts;
function linesMap() {

if (GBrowserIsCompatible()) {

var myString = document.getElementById('HF_LataLonList').value;
var myString1 = document.getElementById('hfroute1').value;
if (myString != '') {

var map = new GMap2(document.getElementById('mapLines'));
var splitted = myString.split(" ");
map.visible = true;
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(splitted[0], splitted[1]), 15);
map.enableContinuousZoom();
map.enableDoubleClickZoom();


var pts1 = new Array();
// alert(splitted.length);
for (var i = 0; i < splitted.length; i++) {
pts1.push(new GLatLng(splitted[i], splitted[i + 1]));
var poly1 = new GPolyline(pts1, "#FF0000", 2, 0.5);
map.addOverlay(poly1);

map.addOverlay(new GMarker(new GLatLng(splitted[i], splitted[i + 1])));
var content = "Testing"
var infowindow = new google.maps.InfoWindow()

google.maps.event.addListener(GMarker, 'click', (function(GMarker, content, infowindow) {
return function() {
infowindow.setContent(content);
infowindow.open(map, GMarker);
};
})(GMarker, content, infowindow));


i++;
}

display only markers but not show info window.
Posted
Updated 30-Jan-15 0:09am
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900