I am trying to show several google maps on my page, I have tried to change function name but with no luck, does anybody knows where must I change a name of varibles. Becuase I have tried to change the initialize function to initialize2 but I think I have to change this name in more places, as I have several addresses
Here is my code so far
$(document).ready(function () { /* google maps */ google.maps.visualRefresh = true; var map; function initialize() { var geocoder = new google.maps.Geocoder(); var address = $('#map-eindhoven').text(); /* change the map-input to your address */ var mapOptions = { zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map-canvas-eindhoven'), mapOptions); if (geocoder) { geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { map.setCenter(results[0].geometry.location); var infowindow = new google.maps.InfoWindow( { content: address, map: map, position: results[0].geometry.location, }); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: map, title: address }); } else { alert("No results found"); } } }); } } google.maps.event.addDomListener(window, 'load', initialize); var map; function initialize2() { var geocoder = new google.maps.Geocoder(); var address = $('#map-rotterdam').text(); /* change the map-input to your address */ var mapOptions = { zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map-canvas-rotterdam'), mapOptions); if (geocoder) { geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { map.setCenter(results[0].geometry.location); var infowindow = new google.maps.InfoWindow( { content: address, map: map, position: results[0].geometry.location, }); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: map, title: address }); } else { alert("No results found"); } } }); } } google.maps.event.addDomListener(window, 'load', initialize2); });