<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak="></script>
<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<title>GPS转百度</title>
<script>
var point = new BMap.Point(116.331398,39.897445);
//判断手机浏览器是否支持定位
if(navigator.geolocation){
var geolocation = new BMap.Geolocation();//创建定位实例
geolocation.getCurrentPosition(showLocation,{enableHighAccuracy: true});//enableHighAccuracy 要求浏览器获取最佳结果
}else{
map.addControl(new BMap.GeolocationControl());//添加定位控件 支持定位
}
//处理定位后的信息
function showLocation(r){
if(this.getStatus() == BMAP_STATUS_SUCCESS){//定位成功
//新建中心点 并将地图中心移动过去
alert("百度:"+r.longitude+","+r.latitude);
}
else {
alert('failed'+this.getStatus());//定位失败
}
}
</script>
</head>
<body>
<div id="allmap"></div>
百度jsapi
</body>
</html>

最新文章

  1. Hibernate框架之Criteria查询 和注解(重点☆☆☆☆☆,难点☆☆☆)
  2. yii2 数据库操作(转)
  3. 解决org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms org.springframework.beans.BeanInstantiation
  4. FAQ: C++中定义类的对象:用new和不用new有何区别?
  5. FastJson之有道翻译
  6. Mybatis 学习-1
  7. 【英语】Bingo口语笔记(57) - 常见的口语弱读
  8. angular 输入框实现自定义验证
  9. Jmeter连接DB2/ORACLE/MYSQL数据库
  10. MySQL中时间函数NOW()和SYSDATE()的区别
  11. springboot 出现 Connection refused: connect
  12. redis 数据结构及应用场景
  13. 对于react中rredux的理解
  14. 基于Electron+.NET Core的前后端分离的跨平台桌面应用
  15. 使用docker搭建数据分析环境
  16. JavaScript之简易http接口测试工具网页版
  17. rest framework 源码流程
  18. kvm虚拟机日常操作命令梳理
  19. Python基础教程-第3版(文字版) 超清文字-非扫描版 [免积分、免登录]
  20. 9/252D图的画法

热门文章

  1. Activiti介绍(一)
  2. Android逆向之旅---基于对so中的函数加密技术实现so加固
  3. android设置系统默认开机时间
  4. python-zx笔记9-单元测试
  5. eclipse中maven工程添加本地库至Maven Dependencies
  6. IPv6测试环境搭建
  7. leetcode 215. 数组中的第K个最大元素(python)
  8. 在windows上使用xdmcp登陆centos,红帽linux
  9. IrfanView - 图片浏览、编辑、批处理神器
  10. Cookie 记录最后访问时间