【发布时间】:2014-11-05 10:30:07
【问题描述】:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
<script type="text/javascript" src="js/markerwithlabel.js"></script>
<script type="text/javascript">
function initMap() {
var latLng = new google.maps.LatLng(-7.178996,115.5241033);
var homeLatLng = new google.maps.LatLng(-7.178996,115.5241033);
var map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 2,
center: latLng,
mapTypeId: google.maps.MapTypeId.SATELLITE
});
var marker1 = new MarkerWithLabel({
position: new google.maps.LatLng(12.5, 92.75),
draggable: false,
raiseOnDrag: false,
map: map,
labelContent: "Andaman",
labelAnchor: new google.maps.Point(22, 0),
labelClass: "labels", // the CSS class for the label
});
var marker2 = new MarkerWithLabel({
position: new google.maps.LatLng(1.4293648, 114.0550177),
draggable: false,
raiseOnDrag: false,
map: map,
labelContent: "Borneo",
labelAnchor: new google.maps.Point(22, 0),
labelClass: "labels", // the CSS class for the label
});
var iw1 = new google.maps.InfoWindow({
content: "<div class='gm'>mycontent</div>"
});
var iw2 = new google.maps.InfoWindow({
content: "<div class='gm'>mycontent</div>"
});
google.maps.event.addListener(marker1, "click", function (e) { iw1.open(map, this); });
google.maps.event.addListener(marker2, "click", function (e) { iw2.open(map, this); });
</script>
【问题讨论】:
标签: google-maps google-maps-api-3 infowindow