社工之經度緯度定位-50米以內

NO IMAGE
1 Star2 Stars3 Stars4 Stars5 Stars 給文章打分!
Loading...

https://bbs.ichunqiu.com/thread-23489-1-1.html?from=zh

現在我們開啟

 

http://www.gpsspg.com/maps.htm

把經度緯度寫上去

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="請求位置資訊"><br>
<textarea name="content" id="content" cols="30" rows="10"></textarea>
<script>
    window.onload = function () {
        var oBtn = document.getElementsByTagName('input')[0];
        var oTextarea = document.getElementById('content');

        oBtn.onclick = function () {
            navigator.geolocation.getCurrentPosition(function (position) {
                oTextarea.value  = "\n 當前經度:" position.coords.longitude;
                oTextarea.value  = "\n 當前緯度:" position.coords.latitude;
                oTextarea.value  = '\n 準確度:'   position.coords.accuracy;
                oTextarea.value  = '\n 海拔:'   position.coords.altitude;
                oTextarea.value  ='\n 海拔準確度:'  position.coords.altitudeAccuracy;
                oTextarea.value  = '\n 行進方向:'   position.coords.heading;
            }, function (error) {
                console.log(error)
                alert(error.code);
            },{
                enableHighAcuracy : true,
                timeout :10000,
                maximumAge : 10000
            });
        }
    }
</script>

</body>
</html>

 

前端開發 最新文章