html获取当前经纬度
来源:互联网 发布:unity3d 麻将桌 编辑:程序博客网 时间:2024/06/06 05:51
<script>
var lng=0, lat=0;//经纬度
if (window.navigator.geolocation) {
var options = {
enableHighAccuracy: true,
};
window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options);
} else {
//浏览器不支持html5来获取地理位置信息
}
function handleSuccess(position){
// 获取到当前位置经纬度 本例中是chrome浏览器取到的是google地图中的经纬度
lng = position.coords.longitude;
lat = position.coords.latitude;
console.log('lng:'+lng+'========lat:'+lat);
}
function handleError(error){//地理位置信息获取失败
console.log('地理位置信息获取失败');
}
</script>
var lng=0, lat=0;//经纬度
if (window.navigator.geolocation) {
var options = {
enableHighAccuracy: true,
};
window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options);
} else {
//浏览器不支持html5来获取地理位置信息
}
function handleSuccess(position){
// 获取到当前位置经纬度 本例中是chrome浏览器取到的是google地图中的经纬度
lng = position.coords.longitude;
lat = position.coords.latitude;
console.log('lng:'+lng+'========lat:'+lat);
}
function handleError(error){//地理位置信息获取失败
console.log('地理位置信息获取失败');
}
</script>
阅读全文
0 0
- html获取当前经纬度
- 获取当前经纬度方法
- 获取当前经纬度方法
- 获取当前经纬度方法
- ios获取当前经纬度
- iOS 获取当前经纬度
- iOS 获取当前经纬度
- 获取手机当前经纬度
- iOS获取当前经纬度
- 获取当前经纬度坐标
- 实现手机获取当前经纬度
- iOS 获取当前经纬度
- Android定位获取当前经纬度
- 根据经纬度获取当前地址
- 获取当前经纬度并根据经纬度反编译城市地址
- 点击按钮根据GPS获取当前经纬度
- Android GPS获取当前经纬度坐标
- Android 获取手机当前所在的经纬度
- js for循环输出i为同一值得问题
- TensorFlow之windows离线安装
- form表单序列化时缺少一些下拉框字段的原因
- 【备忘】Java菜鸟到大牛学习路线培训教程
- 加载——水位上移效果
- html获取当前经纬度
- Redis配置及密码修改等
- Java工程师的一些面试总结(4)
- Linux中more和less命令用法
- ugui学习——可动态改变Content大小的ScrollView
- 在centos中用脚本给firefox导入certificate
- 微信js-sdk分享朋友圈回调事件
- Ajax和JSon
- Xcode执行Analyze静态分析