I suggest using Firebug or Chrome Developer Tools to debug your page. When you click on a Fusion Tables feature, you attempt to access the map in the line:
iw.open(map); However, map is a local variable to the initialize function. If you make map global, then your code should work. Regards, James On Tue, Jul 20, 2010 at 3:03 PM, FeliX <[email protected]> wrote: > > > <script type="text/javascript" src="http://maps.google.com/maps/api/js? > sensor=true"></script> > <script type="text/javascript"> > var iw = null; > function initialize() { > var latlng = new google.maps.LatLng(-40.49173549,173.4209429); > var myOptions = { zoom: 5, center: latlng, mapTypeId: > google.maps.MapTypeId.TERRAIN }; > var map = new google.maps.Map(document.getElementById("map_site"), > myOptions); > > layer = new google.maps.FusionTablesLayer(217476, > { suppressInfoWindows: true}); > > layer.setMap(map); > > google.maps.event.addListener(layer, 'click', displaySite); > } > function displaySite(mouseEvent) { > if (iw != null) {iw.close();} > alert(mouseEvent.row['site'].value); > var content = mouseEvent.row['site'].value; > iw = new google.maps.InfoWindow({content: content,position: > mouseEvent.position}); > iw.open(map); > } > </script> > </head> > <body onLoad="initialize()" style="height=500"> > <div id="map_site" style="width:100%; height:500"></div> > </body> > </html> > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
