<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title></title> 
//在这里要注意js的引入顺序 
<link href="https://www.jb51.net/css/jquery.ui.base.css" type="text/css" /> 
<link href="https://www.jb51.net/css/jquery.ui.theme.css" type="text/css" /> 
<script src="https://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery-1.9.1.js" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery.mousewheel.js" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery.ui.core.js" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery.ui.widget.js" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery.ui.button.js" type="text/javascript"></script> 
<script src="https://www.jb51.net/js/jquery.ui.spinner.js" type="text/javascript"></script> 
<link href="https://www.jb51.net/css/demos.css" type="text/css" /> 
<script type="text/javascript"> 
$(function () { 
function latlong() { 
return new google.maps.LatLng($("#lat").val(), $("#lng").val()); 
} 
function position() { 
map.setCenter(latlong()); 
} 
$("#lat, #lng").spinner({ 
step: .001, 
change: position, 
stop: position 
}); 
var map = new google.maps.Map($("#map")[0], { 
zoom: 8, 
center: latlong(), 
mapTypeId: google.maps.MapTypeId.ROADMAP 
}); 
}); 
</script> 
<style type="text/css"> 
#map { 
width:500px; 
height:500px; 
} 
</style> 
</head> 
<body> 
<label for="lat">纬度</label> 
<input value="44.797"/> 
<br> 
<label for="lng">经度</label> 
<input value="-93.278"/> 
<div></div> 
<div> 
</div> 
</body> 
</html> 
jQuery根据纬度经度查看地图处理程序
内容版权声明:除非注明,否则皆为本站原创文章。
