html5Geolocation地理定位

来源:互联网 发布:wifi局域网劫持软件 编辑:程序博客网 时间:2024/04/30 09:17

<html>
<head>
    <title>Geolocation API地理定位</title>
    <script type="text/javascript">
        navigator.geolocation.getCurrentPostion(function(pos) {
            console.log("当前地理位置的纬度:" + pos.coords.laitude);
            console.log("当前地理位置的经度:" + pos.coords.longitude);
            console.log("当前经纬度的经度:" + pos.coords.accuracy);
        });

        var watchID = navigator.geolocation.witchPosition(function(pos) {
            console.log("当前位置变化的纬度:" + pos.coords.laitude);
            console.log("当前位置变化的经度:" + pos.coords.longitude);
            console.log("当前位置变化的经度:" + pos.coords.accuracy);

            navigator.geolocation.clearwatch(watchID);
        }, function() { });
    </script>
</head>
<body>

</body>
</html>

0 0
原创粉丝点击