Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
We are facing issue with displaying google map "info window" and also changing map icon on external div

Combination of the both displaying the Info window and changing the marker icon on the Map is crashing the info window

This change is not supporting in IE 10 and Map is not displaying in IE9

Can you assist me as soon as possible.
Posted
Updated 27-Aug-20 19:49pm

This is along the lines I have implemented if it is of any use :-





<title>My Site

type="text/javascript"&gt;


Your text here




var locations = [
['Point 1', 54.918356, -1.415040,'your file link on click.html'],
['Point 2', 50.015866, 14.525587,'your file link on click.html'],
['Point 3', 52.230204, 21.000769,'your file link on click.html'],
['Point 4', 59.907114, 30.398900,'your file link on click.html'],


];

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3,
center: new google.maps.LatLng(27.088825, 14.465118),
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControl: false
});

var infowindow = new google.maps.InfoWindow({ maxWidth: 100});

var marker;

for (i = 0; i &lt; locations.length; i++)
{
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
icon: 'images/beachflag.png',
map: map
});

google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
window.open(locations[i][3], '_self');
}
})(marker, i));
google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
maxWidth: 100
}
})(marker, i));
}


 
Share this answer
 
May be you can try with document.getElementById(<ref to="" html="" div="">).innerHTML
 
Share this answer
 

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