Attention!
Only javascript functions can be used!
<ui:define name="content"> <script type="text/javascript"> function showWindow(str){ alert("You clicked on the marker in " + str); }; </script> <rd:map mapId="map_canvas" width="700px" height="500px" key="abcdefg" autoCenter="true" showDirections="true"> <rd:marker id="M1" address="A. Vaucampslaan 42" city="1654 Huizingen" country="Belgium" name="RealDolmen HQ" latitude="50.7520688" longitude="4.2634274" onclick="showWindow('Huizingen');"> </rd:marker> <rd:marker id="M2" address="Prins Boudewijnlaan 26" city="2550 Kontich" country="Belgium" name="Office Kontich Boudewijnlaan" latitude="51.1410521" longitude="4.4378872" onclick="showWindow('Kontich');"> </rd:marker> </rd:map> </ui:define>
Using the latlng attribute, you can retrieve where the user has clicked on the map. This gives you a GLatLng object.
<ui:define name="content"> <script type="text/javascript"> function doClick(latlng){ alert("latitude: " + latlng.lat() + "\r\n" + "longitude: " + latlng.lng()); }; </script> <rd:map mapId="map_canvas" width="700px" height="500px" key="abcdefg" autoCenter="true" showDirections="true" onclick="doClick(latlng);"> ... </rd:map> </ui:define>