Google地图实现
API地址:https://developers.google.com/maps/documentation/javascript/tutorial
<div id="map" style="width:600px;height:400px;border:1px solid red;"></div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
window.onload = function () {
var geocoder = new google.maps.Geocoder();//创建地址解析器
var address = '陕西西安高新一路5号';
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var lo = results[0].geometry.location;
var myLatLng = { lat: lo.H, lng: lo.L };
//创建地图
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 16
});
//创建标记
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: address
});
} else {
alert("解析失败: " + status);
}
});
}
</script>

浙公网安备 33010602011771号