<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Location</title>


</head>

<body>
My location is :

<button >Click</button>
<p ></p>

<script type="text/javascript">
var output=document.getElementById("output");
function getLocation()
{
    if (navigator.geolocation)
    {
        navigator.geolocation.getCurrentPosition(showPosition);
    }
    else{output.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
    output.innerHTML="Latitude: " + position.coords.latitude +
        "<br />Longitude: " + position.coords.longitude;
}

</script>

</body>
</html>

JS 获取当前定位  

 

根据两点的经纬度,求距离:

参考:https://www.cnblogs.com/ycsfwhh/archive/2010/12/20/1911232.html

相关文章:

  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-11-14
  • 2022-01-01
  • 2021-12-23
猜你喜欢
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案