首页 > Web开发 > 详细

html5Geolocation地理定位

时间:2015-01-02 09:42:38      阅读:346      评论:0      收藏:0      [点我收藏+]

<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>

html5Geolocation地理定位

原文:http://blog.csdn.net/y_f123/article/details/42339517

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!