On Sep 16, 6:34 am, cwb <[email protected]> wrote: > On Sep 15, 11:58 pm, "[email protected]" <[email protected]> > wrote: > > > On Sep 15, 6:04 pm, cwb <[email protected]> wrote: > > > > I've upgraded from v2 to v3, and generally this is a big improvement. > > > For some reasons my icons do not respond to a click event (I've made > > > no statement about "clickable", I'm told the default is true.) The > > > code is far too much to include it all here. This is based on a v1 > > > example, so I've included the "createMarker" subroutine here. > > > > function createMarker ( somePoint, name, label, html, anIcon ) > > > { > > > gmarkers[markNo] = new google.maps.Marker > > > markNo is a global and is left pointing past the end of the gmarkes > > array. > > > > ({ > > > position: somePoint, > > > title: name, > > > map: lightsMap, > > > shadow: shadowImage, > > > shape: lightShape, > > > icon: anIcon > > > }); > > > gmarkers[markNo].setMap (lightsMap); > > > // revised 11 pm > > > htmls[markNo] = html; > > > var infoWindow = new google.maps.InfoWindow ({ content: html }); > > > google.maps.event.addListener ( gmarkers[markNo], 'click', > > > function() > > > { > > > infoWindow.open ( lightsMap, gmarkers[markNo] ) > > > }); > > > > // save the info we need to use later for the sidebar > > > // add a line to the sidebar html > > > sidebar_html += '<a href="javascript:myclick(' + markNo + ')">' + > > > label + '</a><br>'; > > > markNo++; > > > return gmarkers[markNo]; > > > > } > > > > The full page can be found > > > atwww.lighthousesRus.org/Maps/mapSql3.php?page=GL/ErieWest. > > > > I'd appreciate any suggestions and directions. > > > The icons are clickable. They just don't do anything obvious when > > clicked. If I rewrite your createMarker function to use function > > closure and your myclick function to trigger a click event on > > gmarker[i], everything seems to work as I expect. > > > -- Larry > > Larry - I understand your point, but I have difficulty understanding > your context. Could you insert the changed lines (ie how to I use > "function closure") Yes, the myclick function has always worked.
This isn't doing what you think it is doing (the map doesn't work without it...) // <script src="http://maps.google.com/maps? file=api&v=2&key=ABQIAAAAzYGR-7gmQiLDnzzmnzs63xSA3CesYlVx8xN0MiAmC6DY4uCwexSLRoqXPU2LUtqvuUL5yhhbL- axUQ" // type="text/javascript"></script> Here is my "proof of concept" version of your page (no guarantees...): http://www.geocodezip.com/lighthousesrus_org_mapSql3b.html -- Larry -- 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.
