——————————————————————————————

<script type="text/javascript">            
            //初始化函数
            function init(){
                //判断浏览器是否支持地理共享
                if(navigator.geolocation){
                    //获取地理信息,并指定成功的回调函数
                    navigator.geolocation.getCurrentPosition(function(pos){
                        var x = pos.coords.longitude;//得到经度
                        var y = pos.coords.latitude;//得到纬度
                        alert('经度:'+x+',纬度:'+y);//展示结果
                    });
                }
            }
  </script>

—————————————————————————————

<body style="text-align:center" onload="init();"></body>

—————————————————————————————

相关文章:

  • 2021-09-08
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案