Created
April 26, 2011 20:45
-
-
Save matismasters/943098 to your computer and use it in GitHub Desktop.
HTML y JS para GMAPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAALo9aqudJX-CndJlG93sJ1hT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ3t2QaEC2O7tWK6G8CATgheBuwIQ" type="text/javascript"></script> | |
| <div id="main_wrapper"> | |
| <div id="map_canvas" style="width: 800px; height: 800px"></div> | |
| </div> | |
| <script type="text/javascript"> | |
| var map = new GMap2(document.getElementById("map_canvas")); | |
| map.setCenter(new GLatLng(-31.8, -55.33333), 13); | |
| map.setUIToDefault(); | |
| function createMarker(point, label) | |
| { | |
| var marker = new GMarker(point); | |
| GEvent.addListener(marker, "click", function() | |
| { | |
| marker.openInfoWindowHtml(label); | |
| }); | |
| return marker; | |
| } | |
| <% @places.each do |p| %> | |
| map.addOverlay(createMarker(new GLatLng(<%=p.lat%>,<%=p.long%>),"<h3><%=p.state + ", " + p. name %></h3>")); | |
| <% end %> | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment