<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--meta http-equiv=X-UA-Compatible content="IE=8"--> <script src="//maps.googleapis.com/maps/api/js?v=3.19" type="text/javascript"></script> <style type="text/css"> html, body, #map-canvas { height: 100%; margin: 0; } </style> <script type="text/javascript"> function initialize() { var map = new google.maps.Map( document.getElementById('map-canvas'), { center: new google.maps.LatLng(37.4419, -122.1419), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); var iwInfoWindow; for (i = 0; i < 100; i++) { var latLng = new google.maps.LatLng( 37.4454 + Math.random()/100.0, -122.1455 + Math.random()/100.0); var marker = new google.maps.Marker({ position: latLng, map: map }); var desc = 'some small text'+i; (function (i, marker) { google.maps.event.addListener(marker, 'click', function () { if (!iwInfoWindow) { iwInfoWindow = new google.maps.InfoWindow(); } iwInfoWindow.setContent("Message" + i); iwInfoWindow.open(map, marker); }); })(i, marker); } } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id='map-canvas'></div> </body> </html>