zoukankan      html  css  js  c++  java
  • 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+' ';
    oT.value += '纬度 :' + position.coords.latitude+' ';
    oT.value += '准确度 :' + position.coords.accuracy+' ';
    oT.value += '海拔 :' + position.coords.altitude+' ';
    oT.value += '海拔准确度 :' + position.coords.altitudeAcuracy+' ';
    oT.value += '行进方向 :' + position.coords.heading+' ';
    oT.value += '地面速度 :' + position.coords.speed+' ';
    oT.value += '时间戳:' + new Date(position.timestamp)+' ';


    },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="400px; height:400px; border:1px #000 solid;">
    </textarea>
    </body>
    </html>

  • 相关阅读:
    nodepad++中的正则表达式匹配和替换操作。
    QT Creator配置环境和安装
    圣诞树小程序的制作
    C#编辑xml文件
    delegate里的Invoke和BeginInvoke
    记录RFID操作错误
    关于Panel隐藏横向滚动条
    随笔
    Java图形打印 上下对称三角星
    Centos 7.5安装 Redis 5.0.0
  • 原文地址:https://www.cnblogs.com/1246447850qqcom/p/4876063.html
Copyright © 2011-2022 走看看