你可以做到這一點象下面這樣:
您可以使用的iframe爲
我試着做請求您需要使用iframe來顯示緯度,經度和結果需要的變焦:
<iframe width="300" height="170" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=es;z=14&output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?q='+data.lat+','+data.lon+'&hl=es;z=14&output=embed" style="color:#0000FF;text-align:left" target="_blank">See map bigger</a></small>
OR
您可以使用下面的代碼太:
<script type="text/javascript">
var map;
var infowindow;
var marker;
var geocoder = new google.maps.Geocoder();
function initialize(address) {
geocoder.geocode({'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(latitude, longitude),
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
marker = new google.maps.Marker({
position: new google.maps.LatLng(latitude, longitude),
map: map,
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
google.maps.event.trigger(marker, "click");
} else {
alert("Something got wrong " + status);
}
});
}
jQuery(document).ready(function() {
initialize("[your address]");
});
</script>
<div id="map" style="height: 350px; width: 100%;"></div>