Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (56 sloc) 1.63 KB
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" charset="utf-8"/>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js">
</script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var contentString = '哈哈,新发现!';
window.mark_infos = []
for(var i = 0; i < 10; i++){
show_map(i)
}
function show_map(i) {
window.mark_infos[i] = new google.maps.InfoWindow({
content: contentString
});
var myLatlng = new google.maps.LatLng(-25.363882+i,131.044922+i);
var maker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"有新发现:-)"
});
google.maps.event.addListener(maker, 'click', function() {
for (var j = 0;j < window.mark_infos.length; ++j) {
window.mark_infos[j].close();
}
window.mark_infos[i].open(map, maker);
});
}
}
$(function() {
initialize()
})
</script>
</head>
<body onload="">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>