js实例教程-jQuery根据纬度经度查看地图处理程序

发布时间:2018-11-29 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了js实例教程-jQuery根据纬度经度查看地图处理程序脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。

jQuery根据纬度经度查看地图处理程序代码如下:

<htML XMlns="https://www.w3.org/1999/xhtml">
<head>
<tITle></title>
//在这里要注意js的引入顺序
<link href="css/jquery.ui.base.css" rel="stylesheet" tyPE="text/css" />
<link href="css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
<script src="https://maps.GOOGLE.COM/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.js" type="text/javascript"></script>
<script src="js/jquery.ui.core.js" type="text/javascript"></script>
<script src="js/jquery.ui.widget.js" type="text/javascript"></script>
<script src="js/jquery.ui.button.js" type="text/javascript"></script>
<script src="js/jquery.ui.spinner.js" type="text/javascript"></script>
<link href="css/demos.css" rel="stylesheet" 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 id="lat" name="lat" value="44.797"/>
<br>
<label for="lng">经度</label>
<input id="lng" name="lng" value="-93.278"/>
<p id=";map"></p>
<p class="demo-description">
</p>
</body>
</html>

jQuery根据纬度经度查看地图处理程序代码如下:

<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<title></title>
//在这里要注意js的引入顺序
<link href="css/jquery.ui.base.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
<script src="https://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.js" type="text/javascript"></script>
<script src="js/jquery.ui.core.js" type="text/javascript"></script>
<script src="js/jquery.ui.widget.js" type="text/javascript"></script>
<script src="js/jquery.ui.button.js" type="text/javascript"></script>
<script src="js/jquery.ui.spinner.js" type="text/javascript"></script>
<link href="css/demos.css" rel="stylesheet" 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 id="lat" name="lat" value="44.797"/>
<br>
<label for="lng">经度</label>
<input id="lng" name="lng" value="-93.278"/>
<p id="map"></p>
<p class="demo-description">
</p>
</body>
</html>

觉得可用,就经常来吧!Javascript技巧 脚本宝典 欢迎评论哦!&nbsp;js技巧,巧夺天工,精雕玉琢。小宝典献丑了!

脚本宝典总结

以上是脚本宝典为你收集整理的js实例教程-jQuery根据纬度经度查看地图处理程序全部内容,希望文章能够帮你解决js实例教程-jQuery根据纬度经度查看地图处理程序所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。