Geolocation
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//LBS : 基于地图信息的应用
window.onload = function(){
var oInput = document.getElementById('input1');
var oT = document.getElementById('t1');
var timer = null;
oInput.onclick = function(){
timer = navigator.geolocation.watchPosition(function(position){
oT.value += '经度:' + position.coords.longitude+'\n';
oT.value += '纬度 :' + position.coords.latitude+'\n';
oT.value += '准确度 :' + position.coords.accuracy+'\n';
oT.value += '海拔 :' + position.coords.altitude+'\n';
oT.value += '海拔准确度 :' + position.coords.altitudeAcuracy+'\n';
oT.value += '行进方向 :' + position.coords.heading+'\n';
oT.value += '地面速度 :' + position.coords.speed+'\n';
oT.value += '时间戳:' + new Date(position.timestamp)+'\n';
},function(err){
//err.code // 失败所对应的编号
alert( err.code );
navigator.geolocation.clearWatch(timer);
},{
enableHighAcuracy : true,
timeout : 5000,
maximumAge : 5000,
frequency : 1000
});
};
};
</script>
</head>
<body>
<input type="button" value="请求" id="input1" /><br />
<textarea id="t1" style="width:400px; height:400px; border:1px #000 solid;">
</textarea>
</body>
</html>
最新文章
- 剑指offer七:两个链表的第一个公共结点
- Yii2所提倡的配置管理方案
- Spring JDBCTemplate使用JNDI数据源
- Day_6作业_模拟人生
- 2015年11月30日 spring初级知识讲解(一)装配Bean
- CocoaPods安装第三方出错:XCode7.3
- UESTC 919 SOUND OF DESTINY --二分图最大匹配+匈牙利算法
- sqlite报错OutOfMemory
- 【BZOJ】【1052】【HAOI2007】覆盖问题
- Spring Batch的事务-Part 1:基础
- iCloud之旅
- IIS支持net.tcp
- 翻译Android USB HOST API
- 如何在windows的DOS窗口中正常显示中文(UTF-8字符)
- 第1章2节《MonkeyRunner源码剖析》概述:边界(原创)
- MooseFS代码分析(一)
- linux之常见错误
- Ecplise 快捷键笔记
- 唐平中讲座笔记 Reinforcement mechanism design 20171107
- Python调试打印错误信息
热门文章
- ";Accepted today?";[HDU1177]
- [转]基于gulp和webpack的前端工程化
- OpenResty+lua+GraphicsMagick生成缩略图
- 洛谷 P1012 拼数 Label:续命模拟QAQ
- 这次,雅虎真的撤销QA团队了
- 转载:冷门js技巧
- 【HDU】1850 Being a Good Boy in Spring Festival
- JS:操作样式表2 :用JS实现添加和删除一个类名的功能(addClass()和removeClass())
- URAL 1031. Railway Tickets(spfa)
- 【BZOJ2038】【2009国家集训队】小Z的袜子(hose) 分块+莫队